VECM#
- class cultivars.multivariate.reduced_form.error_correction.VECM(endog, *, order, rank, cointegration_trend='constant', exog=None, contemporaneous=True, names=None, exog_names=None)[source]#
Vector error-correction model, estimated by Johansen’s reduced-rank ML.
The closed specification: every variable in the panel gets an equation, the rank is fixed by the caller, and the Johansen case names where a constant or trend sits relative to the cointegrating space.
ordercounts lags of the levels system, soorder=pcarriesp - 1lagged differences and the inheritedlag_order_selectionchooses it the standard way, on the unrestricted levels VAR. The rank is a property of the data, not of this object, sorank_test()– the trace and maximum-eigenvalue sequence with simulated critical values – can be read from a model built at any rank before committing to one.- Variables:
_endog – The validated
(nobs, k)panel of levels._names – Variable labels.
_order – Lags of the levels system.
_trend – The unrestricted deterministic terms the short-run regression sees, mapped from the Johansen case.
_prior – The base slot for a shrinkage prior, unused by this family.
_rank – The cointegrating rank.
_trend_case (
str) – The Johansen case as given._exog – The exogenous block,
(nobs, 0)for this closed model._exog_names – Exogenous labels, empty here.
_contemporaneous – Whether a current exogenous difference would enter; irrelevant without a block.
See also
VECMResult– the recordfit()returns.VECMX– the conditional model with weakly exogenous integrated regressors.VAR– the levels system this reparameterizes; fit it when the rank test selectsk.
References
Johansen, S. (1991). Estimation and hypothesis testing of cointegration vectors in Gaussian vector autoregressive models. Econometrica, 59(6), 1551-1580.
Johansen, S. (1995). Likelihood-Based Inference in Cointegrated Vector Autoregressive Models. Oxford University Press.
Example
Choose the rank from the data, then fit at it:
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> common = np.cumsum(rng.standard_normal(300)) >>> y = np.column_stack([common, 2 * common + rng.standard_normal(300)]) >>> model = VECM(y, order=2, rank=1) >>> model.rank_test(simulations=2000).selected_rank() 1 >>> res = model.fit() >>> res.n_common_trends, res.normalized_beta().ravel().round(2) (1, array([ 1. , -0.49]))
Attributes#
The Johansen case. |
|
Whether the current exogenous difference enters the short-run equation. |
|
The validated sample. |
|
The weakly exogenous block, zero-width for a closed system. |
|
Exogenous labels. |
|
Whether a prior contributes anything to this estimate. |
|
every integrated variable plus any restricted term. |
|
Number of endogenous variables. |
|
Weakly exogenous integrated regressors. |
|
Short-run regressors per equation. |
|
Variable labels. |
|
Autoregressive order. |
|
The prior on the coefficients; |
|
Cointegrating rank. |
|
Deterministic specification. |
Methods#
|
Estimate the system at the specified rank and return the result. |
|
Score every order from zero to |
|
Trace and maximum-eigenvalue tests for every candidate rank. |