pyhctsa.operations.stationarity.pp_test

pyhctsa.operations.stationarity.pp_test(y, lags=None, model='ar', test_statistic='t1')

Phillips-Perron unit-root test statistics and p-values.

Tests the null hypothesis that the series has a unit root (is a random walk) against a stationary alternative. For each requested number of Newey-West lags, y_t is regressed on y_{t-1} (plus an optional constant and trend), the Phillips-Perron statistic is formed with a Bartlett-kernel long-run variance estimate, and its left-tail p-value is obtained from the Dickey-Fuller null distribution with MacKinnon’s response-surface approximation (both via arch.unitroot.PhillipsPerron).

Parameters:
y : array-like

The input time series (NaNs are removed; infinite values raise ValueError).

lags : int or list of int, optional

Number of autocovariance lags in the Newey-West long-run variance. A scalar gives the single-lag outputs; a list gives summaries over the lags. Default is [0, 1, 2, 3, 4, 5].

model : {'ar', 'ard', 'ts'}, optional

Alternative model: AR(1) without deterministic terms, with drift (constant), or trend stationary (constant and linear trend). Default is 'ar'.

test_statistic : {'t1', 't2'}, optional

't1': modification of the t statistic (Z_tau); 't2': modification of the unstudentized statistic T (a - 1) (Z_rho). Default is 't1'.

Returns:

Single lag: pvalue, stat, coeff1 (first regression coefficient), loglikelihood, AIC, BIC, HQC (each divided by the series length) and rmse. Several lags: minpValue, meanpValue, lagmaxp, lagminp (the lags with the largest and smallest p-value; the first in list order on ties), meanstat and minBIC (divided by the series length; the test regression does not depend on the lag, which only enters the variance correction of the statistic, so this is the BIC of that one regression).

Return type:

dict

Notes

Phillips & Perron (1988), Biometrika 75:335-346; Hamilton (1994), Time Series Analysis, Sec. 17.6; Newey & West (1987), Econometrica 55:703-708; MacKinnon (1994) J. Business & Economic Statistics 12:167-176 and (2010) Queen’s Economics Department Working Paper 1227 for the p-values, which are not clamped.