arch.unitroot.PhillipsPerron¶

class arch.unitroot.PhillipsPerron(y, lags=None, trend='c', test_type='tau')[source]

Phillips-Perron unit root test

Parameters
• y ({ndarray, Series}) – The data to test for a unit root

• lags (int, optional) – The number of lags to use in the Newey-West estimator of the long-run covariance. If omitted or None, the lag length is set automatically to 12 * (nobs/100) ** (1/4)

• trend ({"n", "c", "ct"}, optional) –

The trend component to include in the test

• ”n” - No trend components

• ”c” - Include a constant (Default)

• ”ct” - Include a constant and linear time trend

• test_type ({"tau", "rho"}) – The test to use when computing the test statistic. “tau” is based on the t-stat and “rho” uses a test based on nobs times the re-centered regression coefficient

Notes

The null hypothesis of the Phillips-Perron (PP) test is that there is a unit root, with the alternative that there is no unit root. If the pvalue is above a critical size, then the null cannot be rejected that there and the series appears to be a unit root.

Unlike the ADF test, the regression estimated includes only one lag of the dependant variable, in addition to trend terms. Any serial correlation in the regression errors is accounted for using a long-run variance estimator (currently Newey-West).

The p-values are obtained through regression surface approximation from MacKinnon (1994) using the updated 2010 tables. If the p-value is close to significant, then the critical values should be used to judge whether to reject the null.

Examples

>>> from arch.unitroot import PhillipsPerron
>>> import numpy as np
>>> import statsmodels.api as sm
>>> data = sm.datasets.macrodata.load().data
>>> inflation = np.diff(np.log(data["cpi"]))
>>> pp = PhillipsPerron(inflation)
>>> print("{0:0.4f}".format(pp.stat))
-8.1356
>>> print("{0:0.4f}".format(pp.pvalue))
0.0000
>>> pp.lags
15
>>> pp.trend = "ct"
>>> print("{0:0.4f}".format(pp.stat))
-8.2022
>>> print("{0:0.4f}".format(pp.pvalue))
0.0000
>>> pp.test_type = "rho"
>>> print("{0:0.4f}".format(pp.stat))
-120.3271
>>> print("{0:0.4f}".format(pp.pvalue))
0.0000


References

*

Hamilton, J. D. 1994. Time Series Analysis. Princeton: Princeton University Press.

Newey, W. K., and K. D. West. 1987. “A simple, positive semidefinite, heteroskedasticity and autocorrelation consistent covariance matrix”. Econometrica 55, 703-708.

Phillips, P. C. B., and P. Perron. 1988. “Testing for a unit root in time series regression”. Biometrika 75, 335-346.

§

MacKinnon, J.G. 1994. “Approximate asymptotic distribution functions for unit-root and cointegration bootstrap”. Journal of Business and Economic Statistics. 12, 167-76.

MacKinnon, J.G. 2010. “Critical Values for Cointegration Tests.” Queen’s University, Dept of Economics, Working Papers. Available at https://ideas.repec.org/p/qed/wpaper/1227.html

Methods

 Summary of test, containing statistic, p-value and critical values

Properties

 alternative_hypothesis The alternative hypothesis critical_values Dictionary containing critical values specific to the test, number of observations and included deterministic trend terms. lags Sets or gets the number of lags used in the model. nobs The number of observations used when computing the test statistic. null_hypothesis The null hypothesis pvalue Returns the p-value for the test statistic regression Returns OLS regression results for the specification used in the test stat The test statistic for a unit root test_type Gets or sets the test type returned by stat. trend Sets or gets the deterministic trend term used in the test. valid_trends List of valid trend terms. y Returns the data used in the test statistic