Estimate either a VECM by Engle-Granger or Johansen (MLE) method.

1 2 3 |

`data` |
multivariate time series (first row being first=oldest value) |

`lag` |
Number of lags (in the VECM representation, see Details) |

`r` |
Number of cointegrating relationships |

`include` |
Type of deterministic regressors to include |

`beta` |
for VECM only: imposed cointegrating value. If null, will be estimated so values will be estimated |

`estim` |
Type of estimator: |

`LRinclude` |
Type of deterministic regressors to include in the long-term relationship. Can also be a matrix with exogeneous regressors (2OLS only). |

`exogen` |
Inclusion of exogenous variables (first row being first=oldest value). Is either of same size than data (then automatically cut) or than end-sample. |

This function is just a wrapper for the `lineVar`

, with
model="VECM".

More comprehensive functions for VECM are in package vars. A few differences appear in the VECM estimation:

- Engle-Granger estimator
The Engle-Granger estimator is available

- Presentation
Results are printed in a different ways, using a matrix form

- lateX export
The matrix of coefficients can be exported to latex, with or without standard-values and significance stars

- Prediction
The

`predict`

method contains a`newdata`

argument allowing to compute rolling forecasts.

Two estimators are available: the Engle-Granger two step approach
(`2OLS`

) or the Johansen (`ML`

). For the 2OLS, deterministics
regressors (or external variables if LRinclude is of class numeric) can be
added for the estimation of the cointegrating value and for the ECT. This is
only working when the beta value is not pre-specified.

The arg beta is the cointegrating value, the cointegrating vector will be taken as: (1, -beta).

Note that the lag specification corresponds to the lags in the VECM representation, not in the VAR (as is done in package vars or software GRETL). Basically, a VAR with 2 lags corresponds here to a VECM with 1 lag. Lag 0 in the VECM is not allowed.

#'The arg `beta`

allows to specify constrained cointegrating values, leading to
*ECT= β^{'}X_{t-1}*. It should be specified as a *K \times r* matrix. In case of
*r=1*, can also be specified as a vector. Note that the vector should be normalised,
with the first value to 1, and the next values showing the opposite sign in the long-run relationship *- β*.
In case the vector has *K-1* values, this is what `lineVar`

is doing, setting *(1, - β)*.
Note finally one should provide values for all
the coefficients (eventually except for special case of r=1 and k-1), if you want to provide only part of the
parameters, and let the others be estimated, look at the functions in package urca.

An object of class `VECM`

(and higher classes `VAR`

and
`nlVar`

) with methods:

- Usual methods
Print, summary, plot, residuals, fitted, vcov

- Fit criteria
AIC, BIC,

`MAPE`

,`mse`

,`logLik`

(latter only for models estimated with MLE)- Prediction
Predict and

`predict_rolling`

- VAR/VECM methods
Impulse response function (

`irf`

) and forecast error variance decomposition (`fevd`

)- LaTeX
toLatex

Matthieu Stigler

`lineVar`

`TVAR`

and `TVECM`

for
the correspoding threshold models. `linear`

for the univariate AR
model.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ```
data(zeroyld)
data<-zeroyld
#Fit a VECM with Engle-Granger 2OLS estimator:
vecm.eg<-VECM(zeroyld, lag=2)
#Fit a VECM with Johansen MLE estimator:
vecm.jo<-VECM(zeroyld, lag=2, estim="ML")
#compare results with package vars:
if(require(vars)) {
data(finland)
#check long coint values
all.equal(VECM(finland, lag=2, estim="ML", r=2)$model.specific$beta,
cajorls(ca.jo(finland, K=3, spec="transitory"), r=2) $beta, check.attributes=FALSE)
# check OLS parameters
all.equal(t(coefficients(VECM(finland, lag=2, estim="ML", r=2))),
coefficients(cajorls(ca.jo(finland, K=3, spec="transitory"), r=2)$rlm), check.attributes=FALSE)
}
##export to Latex
toLatex(vecm.eg)
toLatex(summary(vecm.eg))
options("show.signif.stars"=FALSE)
toLatex(summary(vecm.eg), parenthese="Pvalue")
options("show.signif.stars"=TRUE)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.