arch.unitroot.DFGLS

class arch.unitroot.DFGLS(y: ndarray | DataFrame | Series, lags: int | None = None, trend: 'c' | 'ct' = 'c', max_lags: int | None = None, method: 'aic' | 'bic' | 't-stat' = 'aic', low_memory: bool | None = None)[source]

Elliott, Rothenberg and Stock’s ([ers]) GLS detrended Dickey-Fuller

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 ADF regression. If omitted or None, method is used to automatically select the lag length with no more than max_lags are included.

trend: 'c' | 'ct' = 'c'

The trend component to include in the test

  • ”c” - Include a constant (Default)

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

max_lags: int | None = None

The maximum number of lags to use when selecting lag length. When using automatic lag length selection, the lag is selected using OLS detrending rather than GLS detrending ([pq]).

method: 'aic' | 'bic' | 't-stat' = 'aic'

The method to use when selecting the lag length

  • ”AIC” - Select the minimum of the Akaike IC

  • ”BIC” - Select the minimum of the Schwarz/Bayesian IC

  • ”t-stat” - Select the minimum of the Schwarz/Bayesian IC

Notes

The null hypothesis of the Dickey-Fuller GLS 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 and the series appears to be a unit root.

DFGLS differs from the ADF test in that an initial GLS detrending step is used before a trend-less ADF regression is run.

Critical values and p-values when trend is “c” are identical to the ADF. When trend is set to “ct”, they are from novel simulations.

Examples

>>> from arch.unitroot import DFGLS
>>> import numpy as np
>>> import statsmodels.api as sm
>>> data = sm.datasets.macrodata.load().data
>>> inflation = np.diff(np.log(data["cpi"]))
>>> dfgls = DFGLS(inflation)
>>> print(f"{dfgls.stat:0.4f}")
-2.7611
>>> print(f"{dfgls.pvalue:0.4f}")
0.0059
>>> dfgls.lags
2
>>> dfgls = DFGLS(inflation, trend = "ct")
>>> print(f"{dfgls.stat:0.4f}")
-2.9036
>>> print(f"{dfgls.pvalue:0.4f}")
0.0447

References

[ers]

Elliott, G. R., T. J. Rothenberg, and J. H. Stock. 1996. Efficient bootstrap for an autoregressive unit root. Econometrica 64: 813-836

[pq]

Perron, P., & Qu, Z. (2007). A simple modification to improve the finite sample properties of Ng and Perron’s unit root tests. Economics letters, 94(1), 12-19.

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.

max_lags

Sets or gets the maximum lags used when automatically selecting lag length

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 the OLS regression results from the ADF model estimated

stat

The test statistic for a unit root

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