statsmodels.tsa.stattools.adfuller

statsmodels.tsa.stattools.adfuller(x, maxlag=None, regression='c', autolag='AIC', store=False, regresults=False)[source]

Augmented Dickey-Fuller unit root test.

The Augmented Dickey-Fuller test can be used to test for a unit root in a univariate process in the presence of serial correlation.

Parameters:
xarray_like, 1d

The data series to test.

maxlag{None, int}

Maximum lag which is included in test, default value of 12*(nobs/100)^{1/4} is used when None.

regression{“c”,”ct”,”ctt”,”n”}

Constant and trend order to include in regression.

  • “c” : constant only (default).

  • “ct” : constant and trend.

  • “ctt” : constant, and linear and quadratic trend.

  • “n” : no constant, no trend.

autolag{“AIC”, “BIC”, “t-stat”, None}

Method to use when automatically determining the lag length among the values 0, 1, …, maxlag.

  • If “AIC” (default) or “BIC”, then the number of lags is chosen to minimize the corresponding information criterion.

  • “t-stat” based choice of maxlag. Starts with maxlag and drops a lag until the t-statistic on the last lag length is significant using a 5%-sized test.

  • If None, then the number of included lags is set to maxlag.

storebool

If True, then a result instance is returned additionally to the adf statistic. Default is False.

regresultsbool, optional

If True, the full regression results are returned. Default is False.

Returns:
adffloat

The test statistic.

pvaluefloat

MacKinnon’s approximate p-value based on MacKinnon (1994, 2010).

usedlagint

The number of lags used.

nobsint

The number of observations used for the ADF regression and calculation of the critical values.

critical valuesdict

Critical values for the test statistic at the 1 %, 5 %, and 10 % levels. Based on MacKinnon (2010).

icbestfloat

The maximized information criterion if autolag is not None.

resstoreResultStore, optional

A dummy class with results attached as attributes.

Notes

The null hypothesis of the Augmented Dickey-Fuller 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 we cannot reject that there is a unit root.

The p-values are obtained through regression surface approximation from MacKinnon 1994, but 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.

The autolag option and maxlag for it are described in Greene.

See the notebook Stationarity and detrending (ADF/KPSS) for an overview.

References

[1]
  1. Green. “Econometric Analysis,” 5th ed., Pearson, 2003.

[2]

Hamilton, J.D. “Time Series Analysis”. Princeton, 1994.

[3]

MacKinnon, J.G. 1994. “Approximate asymptotic distribution functions for unit-root and cointegration tests. Journal of Business and Economic Statistics 12, 167-76.

[4]

MacKinnon, J.G. 2010. “Critical Values for Cointegration Tests.” Queen”s University, Dept of Economics, Working Papers. Available at http://ideas.repec.org/p/qed/wpaper/1227.html


Last update: Nov 14, 2024