arch.unitroot.PhillipsPerron¶
-
class arch.unitroot.PhillipsPerron(y: ndarray | DataFrame | Series, lags: int | None =
None
, trend: 'n' | 'c' | 'ct' ='c'
, test_type: 'tau' | 'rho' ='tau'
)[source]¶ Phillips-Perron unit root test
- Parameters:¶
- y: ndarray | DataFrame | Series¶
The data to test for a unit root
- lags: int | None =
None
¶ 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' =
'c'
¶ 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' =
'tau'
¶ 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).
See Philips and Perron for details [3]. See Hamilton [1] for more on PP tests. Newey and West contains information about long-run variance estimation [2]. The p-values are obtained through regression surface approximation using the mathodology of MacKinnon [4] and [5], only using many more simulations.
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(f"{pp.stat:0.4f}") -8.1356 >>> print(f"{pp.pvalue:0.4f}") 0.0000 >>> pp.lags 15 >>> pp.trend = "ct" >>> print(f"{pp.stat:0.4f}") -8.2022 >>> print(f"{pp.pvalue:0.4f}") 0.0000 >>> pp.test_type = "rho" >>> print(f"{pp.stat:0.4f}") -120.3271 >>> print(f"{pp.pvalue:0.4f}") 0.0000
References
Methods
summary
()Summary of test, containing statistic, p-value and critical values
Properties
The alternative hypothesis
Dictionary containing critical values specific to the test, number of observations and included deterministic trend terms.
Sets or gets the number of lags used in the model.
The number of observations used when computing the test statistic.
The null hypothesis
Returns the p-value for the test statistic
Returns OLS regression results for the specification used in the test
The test statistic for a unit root
Gets or sets the test type returned by stat.
Sets or gets the deterministic trend term used in the test.
List of valid trend terms.
Returns the data used in the test statistic