ERS Point Optimal Test

The ERS Point Optimal Test of Elliott, Rothenberg and Stock (1996) compares how well a random walk and a nearby stationary alternative fit the series. Where the other tests measure the coefficient of the lagged level, it takes the ratio of the residual variances of the two fits, the test that is most powerful against that one alternative, and close to the most powerful against the others.

The formula for the ERS Point Optimal Test starts from the quasi-differences of the series at the local alternative bar(alpha), with bar(c) = -7 with a constant and -13.5 with a constant and trend:

\[\bar{\alpha} = 1 + \frac{\bar{c}}{T}\] \[y_{\alpha,1} = y_{1}\] \[y_{\alpha,t} = y_{t} - \bar{\alpha} \cdot y_{t-1}\]

The deterministic terms \(z_{t}\) (1, or 1 and t with a trend) are quasi-differenced alike into \(Z_{\alpha}\), and the OLS regression of the quasi-differenced series \(Y_{\alpha}\) on them gives the residual sum of squares S(bar(alpha)); S(1) is the same at bar(alpha) = 1, the random walk:

\[\hat{\delta} = (Z'_{\alpha} \cdot Z_{\alpha})^{-1} \cdot Z'_{\alpha} \cdot Y_{\alpha}\] \[S(\bar{\alpha}) = U' \cdot U\] \[\text{where}\;\; U = Y_{\alpha} - Z_{\alpha} \cdot \hat{\delta}\]

The long-run variance \(\omega^{2}\) of the errors comes from an autoregression of the changes, fitted by OLS with k lagged changes:

\[\Delta y_{t} = \mu + \beta \cdot t + b_{0} \cdot y_{t-1} + \sum_{j=1}^{k} b_{j} \cdot \Delta y_{t-j} + e_{t}\] \[\hat{\sigma}^{2} = \frac{\sum \hat{e}_{t}^{2}}{n - m}\] \[\hat{\omega}^{2} = \frac{\hat{\sigma}^{2}}{\left(1 - \sum_{j=1}^{k} \hat{b}_{j}\right)^{2}}\]

The statistic compares the two residual sums of squares, scaled by that long-run variance:

\[P_{T} = \frac{S(\bar{\alpha}) - \bar{\alpha} \cdot S(1)}{\hat{\omega}^{2}}\]

Where \(y_{t}\) is the level of the series, T and n the number of observations, beta * t the trend (only in the trend version), k the lagged changes, chosen by the AIC as in the Augmented Dickey-Fuller Test, and m the number of coefficients of the autoregression. A small \(P_{T}\) means the stationary alternative fits nearly as well as the random walk: the unit root is rejected when \(P_{T}\) lies below the critical value of Elliott, Rothenberg and Stock (1996), Table I. Only critical values are published, so there is no p-value. Like the DF-GLS Test it has high power for a series that is only just stationary, and its long-run variance estimate makes it sensitive to the lag choice.

A unit root test asks whether a series wanders like a random walk, where every shock moves its level for good, or is stationary and returns to its mean or trend after a shock. The tests share the same null hypothesis, a unit root (a random walk, not mean-reverting), against the alternative that the series is stationary. Testing for it is a standard first step before modelling a price, spread or rate with mean-reverting methods, which assume stationarity, and before regressing one trending series on another, where a unit root in both makes the regression spurious. The tests differ in how they handle autocorrelated errors, structural breaks and the constant and trend, and in their power against a series that reverts only slowly. Not rejecting the unit root does not prove it: on a short sample a slowly reverting series and a random walk are hard to tell apart. The KPSS test swaps the null and the alternative and is the usual complement.

Also known as: ERS test, point-optimal test, \(P_{T}\) test.

In the Finance Toolkit this is get_unit_root_test with method="ers_point_optimal", the same function as Unit Root Test.

Example · EURUSD, USDJPY, GBPUSD · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_unit_root_test:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["EURUSD", "USDJPY", "GBPUSD"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.econometrics.get_unit_root_test(method="ers_point_optimal")

Which returns:

Using Your Own Data

get_unit_root_test runs on any data, not only prices: ratios, economic indicators, yield curves or your own dataset. Pass a DataFrame, a Series or a dictionary of them to Econometrics as data, with the dates in the rows or the columns, and set changes to how its changes are calculated: "percentage", "log", "difference" for rates and ratios, or None when the data are changes already. For example, for the monthly unemployment rates of the United States and Germany:

from financetoolkit import Economics, Econometrics

economics = Economics(start_date="2000-01-01")

unemployment = economics.get_unemployment_rate(
    countries=["United States", "Germany"], period="monthly"
)

econometrics = Econometrics(data=unemployment, changes="difference")

econometrics.get_unit_root_test()

References

  • Paper Elliott, G., Rothenberg, T.J. and Stock, J.H. (1996). “Efficient Tests for an Autoregressive Unit Root.” Econometrica, 64(4), 813-836.
Share