Logo

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:

x : array_like, 1d

data series

maxlag : int

Maximum lag which is included in test, default 12*(nobs/100)^{1/4}

regression : str {‘c’,’ct’,’ctt’,’nc’}

Constant and trend order to include in regression * ‘c’ : constant only (default) * ‘ct’ : constant and trend * ‘ctt’ : constant, and linear and quadratic trend * ‘nc’ : no constant, no trend

autolag : {‘AIC’, ‘BIC’, ‘t-stat’, None}

  • if None, then maxlag lags are used
  • if ‘AIC’ (default) or ‘BIC’, then the number of lags is chosen to minimize the corresponding information criterium
  • ‘t-stat’ based choice of maxlag. Starts with maxlag and drops a lag until the t-statistic on the last lag length is significant at the 95 % level.

store : bool

If True, then a result instance is returned additionally to the adf statistic (default is False)

regresults : bool

If True, the full regression results are returned (default is False)

Returns:

adf : float

Test statistic

pvalue : float

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

usedlag : int

Number of lags used.

nobs : int

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

critical values : dict

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

icbest : float

The maximized information criterion if autolag is not None.

regresults : RegressionResults instance

The

resstore : (optional) instance of ResultStore

an instance of 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 accept or reject the null.

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

References

Greene Hamilton

P-Values (regression surface approximation) MacKinnon, J.G. 1994. “Approximate asymptotic distribution functions for unit-root and cointegration tests. Journal of Business and Economic Statistics 12, 167-76.

Critical values 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

Examples

see example script

Previous topic

statsmodels.tsa.stattools.periodogram

Next topic

statsmodels.tsa.stattools.q_stat

This Page