arch.unitroot.cointegration.engle_granger¶
-
arch.unitroot.cointegration.engle_granger(y: ndarray[tuple[int], dtype[float64]] | Series, x: ndarray[tuple[int, int], dtype[float64]] | DataFrame, trend: 'n' | 'c' | 'ct' | 'ctt' =
'c', *, lags: int | None =None, max_lags: int | None =None, method: 'aic' | 'bic' | 't-stat' | 'maic' ='bic', low_memory: bool | None =None) EngleGrangerTestResults[source]¶ Test for cointegration within a set of time series.
- Parameters:¶
- y: ndarray[tuple[int], dtype[float64]] | Series¶
The left-hand-side variable in the cointegrating regression. It must be 1-d and contain only finite values.
- x: ndarray[tuple[int, int], dtype[float64]] | DataFrame¶
The right-hand-side variables in the cointegrating regression. It must be 1-d or 2-d with the same number of rows as y, between 1 and 12 columns, the same index as y if both are pandas objects, and contain only finite values. The number of rows must be at least two more than the number of parameters in the cointegrating regression (the number of columns of x and the number of terms in trend).
- trend: 'n' | 'c' | 'ct' | 'ctt' =
'c'¶ Trend to include in the cointegrating regression. Not case sensitive. Trends are:
”n”: No deterministic terms
”c”: Constant
”ct”: Constant and linear trend
”ctt”: Constant, linear and quadratic trends
- lags: int | None =
None¶ The number of lagged differences to include in the Augmented Dickey-Fuller test used on the residuals of the cointegrating regression. It must be a non-negative integer. If None, the number of lags is selected using
method.- max_lags: int | None =
None¶ The maximum number of lags to consider when using automatic lag-length in the Augmented Dickey-Fuller regression. It must be an integer between 0 and nobs - 2.
- method: 'aic' | 'bic' | 't-stat' | 'maic' =
'bic'¶ The method used to select the number of lags included in the Augmented Dickey-Fuller regression. Not case sensitive.
”aic”: Select the minimum of the Akaike IC
”bic”: Select the minimum of the Schwarz/Bayesian IC
”t-stat”: Select the largest lag length for which the t-statistic of the last lag is significant, using a cut-off of 1.645 for the absolute value of the t-statistic
”maic”: Select the minimum of Ng and Perron’s modified Akaike IC
- low_memory: bool | None =
None¶ Flag indicating whether to use the low memory implementation of the lag selection algorithm in the Augmented Dickey-Fuller regression. If None, the algorithm is selected automatically. See
arch.unitroot.ADF.
- Returns:¶
Results of the Engle-Granger test.
- Return type:¶
- Raises:¶
TypeError – If y or x cannot be converted to float64, lags or max_lags is not an integer or None, low_memory is not a bool or None, or trend or method is not a string.
ValueError – If y or x contains NaN or inf, does not have the required dimensions, the same number of rows or the same index, or has too few rows. Also if x has more than 12 columns, lags is negative, max_lags is not between 0 and nobs - 2, or trend or method is not one of the options.
InfeasibleTestException – If the Augmented Dickey-Fuller regression of the residual cannot be estimated with the lags requested. This is also a ValueError.
See also
arch.unitroot.ADFAugmented Dickey-Fuller testing.
arch.unitroot.PhillipsPerronPhillips & Perron’s unit root test.
arch.unitroot.cointegration.phillips_ouliarisPhillips-Ouliaris tests of cointegration.
Notes
The model estimated is
\[Y_t = X_t \beta + D_t \gamma + \epsilon_t\]where \(Z_t = [Y_t,X_t]\) is being tested for cointegration. \(D_t\) is a set of deterministic terms that may include a constant, a time trend or a quadratic time trend.
The null hypothesis is that the series are not cointegrated.
The test is implemented as an ADF of the estimated residuals from the cross-sectional regression using a set of critical values that is determined by the number of assumed stochastic trends when the null hypothesis is true.