Hi!
I get an error I just can't get around. Been trying to find anything to read on this function "predict", but it is hard to find anything useful (too many hits in the help section). If I am correct, the function should be from the package "car"? Are there more functions named "predict" from other packages? I am trying to run the following code:
predict_VAR <- predict(Model_VAR, n.ahead = 16)
According to code by Hyndman, it should work:
trainingdata <- window(Canada, end=c(1998,4))
testdata <- window(Canada, start=c(1999,1))
v <- VAR(trainingdata, p=2)
p <- predict(v, n.ahead=8)
res <- residuals(v)
fits <- fitted(v)
for(i in 1:4)
{
fc <- structure(list(mean=p$fcst[[i]][,"fcst"], x=trainingdata[,i],
fitted=c(NA,NA,fits[,i])),class="forecast")
print(accuracy(fc,testdata[,i]))
}
I get the following error when I use "Predict" with an uppercase letter P:
Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "varest"
And the following error when I use "predict" with a lowercase letter p:
Error in grnn.test(...) : unused argument (n.ahead = 16)
Any ideas of why it doesnt work? What function do I use to predict with my VAR_model?
Any help appreciated!