statsmodels.tsa.stattools.coint¶

statsmodels.tsa.stattools.
coint
(y0, y1, trend='c', method='aeg', maxlag=None, autolag='aic', return_results=None)[source]¶ Test for nocointegration of a univariate equation.
The null hypothesis is no cointegration. Variables in y0 and y1 are assumed to be integrated of order 1, I(1).
This uses the augmented EngleGranger twostep cointegration test. Constant or trend is included in 1st stage regression, i.e. in cointegrating equation.
Warning: The autolag default has changed compared to statsmodels 0.8. In 0.8 autolag was always None, no the keyword is used and defaults to ‘aic’. Use autolag=None to avoid the lag search.
 Parameters
 y0array_like
The first element in cointegrated system. Must be 1d.
 y1array_like
The remaining elements in cointegrated system.
 trend
str
{‘c’, ‘ct’} The trend term included in regression for cointegrating equation.
‘c’ : constant.
‘ct’ : constant and linear trend.
also available quadratic trend ‘ctt’, and no constant ‘nc’.
 method{‘aeg’}
Only ‘aeg’ (augmented EngleGranger) is available.
 maxlag
None
orint
Argument for adfuller, largest or given number of lags.
 autolag
str
Argument for adfuller, lag selection criterion.
If None, then maxlag lags are used without lag search.
If ‘AIC’ (default) or ‘BIC’, then the number of lags is chosen to minimize the corresponding information criterion.
‘tstat’ based choice of maxlag. Starts with maxlag and drops a lag until the tstatistic on the last lag length is significant using a 5%sized test.
 return_resultsbool
For future compatibility, currently only tuple available. If True, then a results instance is returned. Otherwise, a tuple with the test outcome is returned. Set return_results=False to avoid future changes in return.
 Returns
Notes
The Null hypothesis is that there is no cointegration, the alternative hypothesis is that there is cointegrating relationship. If the pvalue is small, below a critical size, then we can reject the hypothesis that there is no cointegrating relationship.
Pvalues and critical values are obtained through regression surface approximation from MacKinnon 1994 and 2010.
If the two series are almost perfectly collinear, then computing the test is numerically unstable. However, the two series will be cointegrated under the maintained assumption that they are integrated. In this case the tstatistic will be set to inf and the pvalue to zero.
TODO: We could handle gaps in data by dropping rows with nans in the Auxiliary regressions. Not implemented yet, currently assumes no nans and no gaps in time series.
References
 1
MacKinnon, J.G. 1994 “Approximate Asymptotic Distribution Functions for UnitRoot and Cointegration Tests.” Journal of Business & Economics Statistics, 12.2, 16776.
 2
MacKinnon, J.G. 2010. “Critical Values for Cointegration Tests.” Queen’s University, Dept of Economics Working Papers 1227. http://ideas.repec.org/p/qed/wpaper/1227.html