# Gaussian state space forecasting with regression effects

The R package dlm implements filtering and smoothing (dlmFilter and dlmSmooth) for models with regression effects, but forecasting is not (yet) available for these models:

mod <- dlmModSeas(4)+dlmModReg(cbind(rnorm(100),rnorm(100)))
fi <- dlmFilter(rnorm(100),mod)
Error in dlmForecast(fi, nAhead = 12):
dlmForecast only works with constant models


How can I do this in R?

nAhead <- 12

• Good idea, and it basically works. I suspect that there's a tradeoff of some sort -- otherwise the dlm folks could simply use that solution to code dlmForecast -- but it does basically work. – Wayne Sep 2 '11 at 18:53