[R] MSBVAR and hc.forecast

david ostrowski davidaostrowski at gmail.com
Fri Feb 4 17:46:39 CET 2011


attempting to do multivariate modelling in R with known future
conditions (in this case variable 'b') using MSBVAR and hc.forecast.
The sample code (a paired down representation) does not give anywhere
near the expected results - I am assuming that a forecast 8 steps out
would approximate 'a' as the sequence 1.1,2.1,3.1,100.1 corresponding
to the input set.

I have varied the input length to be longer  as well as  using longer
simulation times.

If any one has very small example code such as this or knows how to
obtain my expected behavior it is much appreciated!



include("MSBVAR")
a = c(1.1,2.1,3.1,100.1,1.1,2.1,3.1,100.1,1.1,2.1,3.1,100.1,1.1,2.1,3.1,100.1,1.1,2.1,3.1,100.1,1.1,2.1,3.1,100.1)
b = c(1.1,1.1,1.1,100.1,1.1,1.1,1.1,100.1,1.1,1.1,1.,100.1,1.1,1.1,1.1,100.1,1.1,1.1,1.1,100.1,1.1,1.1,1.,100.1)
K <-ts(cbind(a,b),start=c(1.1,1.1), names=c("a","b"))


fit.bvar <- szbvar(K, p = 1, lambda0=0.6, lambda=0.1, lambda3=2,
lambda4=0.25,lambda5=0,mu5=0, mu6=0, prior=0)
y <- matrix(c(rep(0,8),c(1.10,1.10,1.10,100.1,1.10,1.10,1.0,100.10)),ncol=2)
h <- hc.forecast(fit.bvar,y,nsteps=8,burnin=300, gibbs=500,exog=NULL)



More information about the R-help mailing list