arch.unitroot.cointegration.DynamicOLS

class arch.unitroot.cointegration.DynamicOLS(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, leads: int | None = None, common: bool = False, max_lag: int | None = None, max_lead: int | None = None, method: 'aic' | 'bic' | 'hqic' = 'bic')[source]

Dynamic OLS (DOLS) cointegrating vector estimation.

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, at least 1 column, 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 lags to include in the model. If None, the optimal number of lags is chosen using method. It must be an integer between 0 and nobs - 2.

leads: int | None = None

The number of leads to include in the model. If None, the optimal number of leads is chosen using method. It must be an integer between 0 and nobs - 2.

common: bool = False

Flag indicating that lags and leads should be restricted to the same value. When common is True, lags must equal leads and max_lag must equal max_lead.

max_lag: int | None = None

The maximum lag to consider. See Notes for value used when None. It must be an integer between 0 and nobs - 2.

max_lead: int | None = None

The maximum lead to consider. See Notes for value used when None. It must be an integer between 0 and nobs - 2.

method: 'aic' | 'bic' | 'hqic' = 'bic'

The method used to select lag length when lags or leads is None. Not case sensitive.

  • ”aic” - Akaike Information Criterion

  • ”hqic” - Hannan-Quinn Information Criterion

  • ”bic” - Schwartz/Bayesian Information Criterion

Raises:
  • TypeError – If y or x cannot be converted to float64, lags, leads, max_lag or max_lead is not an integer or None, common is not a bool, 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 lags, leads, max_lag or max_lead is not between 0 and nobs - 2, if common is True and lags and leads (or max_lag and max_lead) differ, if the sample that remains after the differences, lags and leads is not larger than the number of parameters of the smallest model that is estimated, or if trend or method is not one of the options.

Notes

The cointegrating vector is estimated from the regression

\[Y_t = D_t \delta + X_t \beta + \Delta X_{t} \gamma + \sum_{i=1}^p \Delta X_{t-i} \kappa_i + \sum _{j=1}^q \Delta X_{t+j} \lambda_j + \epsilon_t\]

where p is the lag length and q is the lead length. \(D_t\) is a vector containing the deterministic terms, if any. All specifications include the contemporaneous difference \(\Delta X_{t}\).

When lag lengths are not provided, the optimal lag length is chosen to minimize an Information Criterion of the form

\[\ln\left(\hat{\sigma}^2\right) + k\frac{c}{T}\]

where c is 2 for Akaike, \(2\ln\ln T\) for Hannan-Quinn and \(\ln T\) for Schwartz/Bayesian.

See [1] and [2] for further details.

References

Methods

fit([cov_type, kernel, bandwidth, ...])

Estimate the Dynamic OLS regression.