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).

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

Methods

summary()

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