Skip to content
Prev 5210 / 15274 Next

R: Use VAR model to predict response to change in values of certain variables

Same remark as before, please provide reproducible code!!

Ok, sorry, showed only the case for var, not vec2var. Well it is more
complicated as there is no corresponding lm object.
(reason is the var in level you obtain is estimated under constraint
of cointegration, so estimating yourself with usual lm won't lead to
same results).

So what you do is simply extract the coef and mutliply with your
predicted values, something like (using again last value, so can see
it's same as using predict):
data(Canada)
sjf.vecm <- ca.jo(Canada, ecdet = "none", type = "eigen", K = 2,spec =
"longrun")
converted<-   vec2var(sjf.vecm, r = 1)

coefe<-c( converted$A$A1[1,], converted$deterministic[1],converted$A$A2[1,])
predval<-converted$datamat[nrow(converted$datamat),c(1:9)]
coefe%*%predval
predict(converted, n.ahead=1)

Hope this helps

Mat


2009/11/24 Karl Schriek <kschriek at gmail.com>: