VECM
Vector Error Correction Model, from statsmodels.
Quickstart
from sktime.forecasting.vecm import VECM
estimator = VECM(dates=None, freq=None, missing='none', k_ar_diff=1, coint_rank=1, deterministic='n', seasons=0, first_season=0, method='ml', exog_coint=None, exog_coint_fc=None)Parameters(11)
- datesarray_like of datetime, optional
See
statsmodels.tsa.base.tsa_model.TimeSeriesModelfor more information.- freqstr, optional
See
statsmodels.tsa.base.tsa_model.TimeSeriesModelfor more information.- missingstr, optional, default=”none”
See
statsmodels.base.model.Modelfor more information.- k_ar_diffint, optional, default=1
- Number of lagged differences in the model. Equals \(k_{ar} - 1\) in the formula above.
- coint_rankint, optional, default=1
- Cointegration rank, equals the rank of the matrix \(\\Pi\) and the number of columns of \(\\alpha\) and \(\\beta\).
- deterministicstr, optional, default=”n”
must be one of {
"n","co","ci","lo","li"}"n"- no deterministic terms"co"- constant outside the cointegration relation"ci"- constant within the cointegration relation"lo"- linear trend outside the cointegration relation"li"- linear trend within the cointegration relation
Combinations of these are possible (e.g.
"cili"or"colo"for linear trend with intercept). When using a constant term you have to choose whether you want to restrict it to the cointegration relation (i.e."ci") or leave it unrestricted (i.e."co"). Do not use both"ci"and"co". The same applies for"li"and"lo"when using a linear term. See the Notes-section for more information.- seasonsint, optional, default: 0
- Number of periods in a seasonal cycle. 0 means no seasons.
- first_seasonint, optional, default: 0
- Season of the first observation.
- methodstr {“ml”}, default: “ml”
- Estimation method to use. “ml” stands for Maximum Likelihood.
- exog_cointoptional, a scalar (float), 1D ndarray of size nobs,
- 2D ndarray/pd.DataFrame of size (any, neqs) Deterministic terms inside the cointegration relation.
- exog_coint_fcoptional, a scalar (float), 1D ndarray of size nobs,
- 2D ndarray/pd.DataFrame of size (any, neqs) Forecasted value of exog_coint
Examples
>>> import numpy as np
>>> import pandas as pd
>>> from sktime.forecasting.vecm import VECM
>>> from sktime.split import temporal_train_test_split
>>> from sktime.forecasting.base import ForecastingHorizon
>>> index = pd. date_range (start = "2005", end = "2006-12", freq = "ME")
>>> df = pd. DataFrame (np. random. randint (0, 100, size = (23, 2)),
... columns = list ("AB"),
... index = pd. PeriodIndex (index))
>>> train, test = temporal_train_test_split (df)
>>> sktime_model = VECM ()
>>> fh = ForecastingHorizon ([1, 3, 4, 5, 7, 9 ])
>>> _ = sktime_model. fit (train, fh = fh)
>>> fc2 = sktime_model. predict (fh = fh)