[R] possible bug in vars package (predict.varest) ???

Pfaff, Bernhard Dr. Bernhard_Pfaff at fra.invesco.com
Fri Aug 31 10:51:59 CEST 2007

Hello Spencer,

which version of vars are you using? This has been fixed a while ago
(see ChangeLog). Incidentally, the data in Canada is quarterly data, as
stated in ?Canada. Aside of this, your code snippet works fine.


ps: There is no need to download the tarball as suggested by Mark,
instead you can do: vars:::predict.varest

>I have been trying to use the predict function in the vars package to
>forecast from a seasonal VAR model. The following code sample 
>what I am trying to do and the error that I get when trying to do it.
>I run the following code, that results in the following error:
>endoC <- Canada[1:72,1:3]
>exoC <- Canada[1:72,4]
>var.2c <- VAR(endoC, p = 2, season=12,exogen=exoC,type = "const")
>exoC_2 <- as.matrix(Canada[73:84,4])
>predict(var.2c, n.ahead = 12,dumvar=exoC_2)
>Error in as.matrix(cycle, nrow = season, ncol = season - 1) :
>        unused argument(s) (nrow = 12, ncol = 11)
>from what I can guess, the predict.varest function is using 
>as.matrix() and
>passing nrow and ncol, as.matrix() does not take those two 
>parameters but
>matrix() does.
>Does anyone have a suggestion of how to get around it? Is 
>there a way I can
>get to the predict.varest() function and alter it myself?
>	[[alternative HTML version deleted]]
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide 
>and provide commented, minimal, self-contained, reproducible code.
Confidentiality Note: The information contained in this mess...{{dropped}}

More information about the R-help mailing list