# NOT RUN {
## Note: The following are toy examples, for a proper analysis we recommend to run
## at least 1000 iterations and check the convergence of the Markov chain
## Example 1 :
y <- cbind(seq(0.5,100,by=0.5)*0.1 + rnorm(200),
seq(100.25,150,by=0.25)*0.05 + rnorm(200),
rnorm(200, 5,1))
mbsts.1 <- as.mbsts(y = y, components = c("trend", "seasonal"), seas.period = 7, s0.r = diag(3),
s0.eps = diag(3), niter = 50, burn = 5)
pred.1 <- predict(mbsts.1, steps.ahead = 10)
## Example 2
y <- cbind(rnorm(100), rnorm(100, 2, 3))
X <- cbind(rnorm(100, 0.5, 1) + 5, rnorm(100, 0.2, 2) - 2)
mbsts.2 <- as.mbsts(y = y, components = c("trend", "seasonal"),
seas.period = 7, X = X, s0.r = diag(2),
s0.eps = diag(2), niter = 100, burn = 10)
newdata <- cbind(rnorm(30), rt(30, 2))
pred.2 <- predict(mbsts.2, newdata = newdata)
# }
Run the code above in your browser using DataLab