Back to models
Param Estimator

JohansenCointegration

Test for cointegration ranks/relationships for VECM Time-Series.

Direct interface to statsmodels.tsa.vector_ar.vecm.

The Johansen Cointegration test is a test solely used in Vector Error Correction Models (VECM) to determine the occurrence of a long-term relationship (cointegration rank) between two time series or several long-term relationships in case of multiple time-series. The idea of the underlying test is to estimate, if such (a) relationship(s) exist(s). In case there is a relationship (or several), the time series used in the model, can be in its original scale in levels without dedifferencing them. Normally, time series not being stationary need to be ‘integrated’(dedifferenced) before using them in time series analysis, e.g. VAR or ARIMA.If however, (a) long-term relationship(s) exist(s), that means that the variables inthe ‘long term’ are stationary ‘together’, and can be used without any transformation. If no relationship (no cointegration rank) is found, a VECM can not be used and a VAR needs to considered but with integrated/dedifferenced time-series. The estimator used in the code determines the coint parameter value to be used in VECM time-series module/estimator vecm.py: coint_rank. Use trace statistics or eigenvalue to find it.

Quickstart

python
from sktime.param_est.cointegration import JohansenCointegration

estimator = JohansenCointegration(det_order=1, k_ar_diff=1)

Parameters(2)

det_orderint, default=1
  • -1 - no deterministic terms

  • 0 - constant term

  • 1 - linear trend

k_ar_diffint, nonnegative, default=1
Number of lagged differences in the model. Needs multivariate version of ARLagOrderSelector, See also: statsmodels.tsa.vector_ar.vecm.select_order

Examples

>>> from sktime.datasets import load_airline
>>> from sktime.param_est.cointegration import JohansenCointegration
>>> import pandas as pd
>>> X = load_airline ()
>>> X2 = X. shift (1). bfill ()
>>> df = pd. DataFrame ({ "X": X, "X2": X2 })
>>> coint_est = JohansenCointegration ()
>>> coint_est. fit (df) JohansenCointegration(
... )
>>> print (coint_est. get_fitted_params ()["cvm" ]) [[15.0006 17.1481 21.7465] [2.7055 3.8415 6.6349]]

References

[1]

Lütkepohl, H. 2005. New Introduction to Multiple Time Series Analysis. Springer.