# NOT RUN {
data(barry)
mod_vecm <- VECM(barry, lag=2)
pred_VECM <- predict(mod_vecm)
mod_var <- lineVar(barry, lag=3)
pred_VAR <- predict(mod_var)
## compare
plot(tail(barry[,1],50), type="l", xlim=c(0,60))
lines(51:55,pred_VAR[,1], lty=2, col=2)
lines(51:55,pred_VECM[,1], lty=2, col=3)
# note that when providing newdata, newdata has to be ordered chronologically,
# so that the first row/element is the earliest value:
all.equal(predict(mod_vecm), predict(mod_vecm, newdata=barry[c(322, 323, 324),]))
# }
Run the code above in your browser using DataLab