Open lcallot opened 5 years ago
The forecast is assigned to pred within the if (output) {...} statement, so that pred=NULL is returned when the argument output=FALSE is set in the call. The assignment of pred should probably be moved outside if (output){...}.
pred
if (output) {...}
pred=NULL
output=FALSE
if (output){...}
https://github.com/d-/MTS/blob/26ecbaf3a23921828d91f4070c383500a839de5e/R/MTS.R#L885
data("mts-examples",package="MTS") gdp=log(qgdp[,3:5]) zt=diffM(gdp) m1=VAR(zt,p=2, output=FALSE) vp=VARpred(m1,4, output=FALSE) vp $pred NULL $se.err [,1] [,2] [,3] [1,] 0.005314548 0.005399830 0.005974661 [2,] 0.005803884 0.007165152 0.007076819 [3,] 0.006201846 0.007672211 0.007344704 [4,] 0.006484131 0.007784789 0.007442406 $rmse [,1] [,2] [,3] [1,] 0.005461328 0.005548966 0.006139673 [2,] 0.038966588 0.078130775 0.063052185 [3,] 0.036637288 0.045955913 0.033289797 [4,] 0.031926258 0.023140137 0.021204768
The forecast is assigned to
pred
within theif (output) {...}
statement, so thatpred=NULL
is returned when the argumentoutput=FALSE
is set in the call. The assignment ofpred
should probably be moved outsideif (output){...}
.https://github.com/d-/MTS/blob/26ecbaf3a23921828d91f4070c383500a839de5e/R/MTS.R#L885