statsmodels.tsa.stattools.coint¶
-
statsmodels.tsa.stattools.
coint
(y0, y1, trend='c', method='aeg', maxlag=None, autolag='aic', return_results=None)[source]¶ Test for no-cointegration 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 Engle-Granger two-step cointegration test. Constant or trend is included in 1st stage regression, i.e. in cointegrating equation.
Parameters: y1 : array_like, 1d
first element in cointegrating vector
y2 : array_like
remaining elements in cointegrating vector
trend : str {‘c’, ‘ct’}
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 : string
currently only ‘aeg’ for augmented Engle-Granger test is available. default might change.
maxlag : None or int
keyword for adfuller, largest or given number of lags
autolag : string
keyword for adfuller, lag selection criterion.
return_results : bool
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: coint_t : float
t-statistic of unit-root test on residuals
pvalue : float
MacKinnon’s approximate, asymptotic p-value based on MacKinnon (1994)
crit_value : dict
Critical values for the test statistic at the 1 %, 5 %, and 10 % levels based on regression curve. This depends on the number of observations.
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.
P-values and critical values are obtained through regression surface approximation from MacKinnon 1994 and 2010.
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
- MacKinnon, J.G. 1994 “Approximate Asymptotic Distribution Functions for
- Unit-Root and Cointegration Tests.” Journal of Business & Economics Statistics, 12.2, 167-76.
- 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