arch.unitroot.DFGLS

class arch.unitroot.DFGLS(y, lags=None, trend='c', max_lags=None, method='AIC', low_memory=None)[source]

Elliott, Rothenberg and Stock's GLS version of the Dickey-Fuller test

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

  • lags (int, optional) -- 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'}, optional) -- The trend component to include in the ADF test 'c' - Include a constant (Default) 'ct' - Include a constant and linear time trend

  • max_lags (int, optional) -- The maximum number of lags to use when selecting lag length

  • method ({'AIC', 'BIC', 't-stat'}, optional) -- 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 ...

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('{0:0.4f}'.format(dfgls.stat))
-2.7611
>>> print('{0:0.4f}'.format(dfgls.pvalue))
0.0059
>>> dfgls.lags
2
>>> dfgls.trend = 'ct'
>>> print('{0:0.4f}'.format(dfgls.stat))
-2.9036
>>> print('{0:0.4f}'.format(dfgls.pvalue))
0.0447

References

*

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

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