I have built a Kalman Filter model for flu forecasting as shown below.
Y - Target Variable X1 - Predictor1 X2 - Predictor2
While forecasting into the future, I will NOT have data for all three variables. So, I am predicting X1 and X2 using two Kalman filters. The code is below
x1.model <- dlmModSeas(52) + dlmModPoly(1, dV=5, dW=10)
x2.model <- dlmModSeas(52) + dlmModPoly(1, dV=10, dW=10)
x1.filter <- dlmFilter(c(train$x1, rep(NA, noofsteps)), x1.model)
x2.filter <- dlmFilter(c(train$x2, rep(NA, noofsteps)), x2.model)
Now, I am forecasting Y using the predicted X1 and X2 as below
pred <- cbind(c(train$x1, x1.filter$f[260:312]),c(train$x2, x2.filter$f[260:312]))
Y.model <- dlmModSeas(52) + dlmModReg(pred, dV=0.5, dW=c(10,0.05,0.1))
Y.filter <- dlmFilter(c(train$Y, rep(NA, noofsteps)), Y.model)
I have two questions
1) The flu season usually starts in early September and it usually peaks during the last week of December or the first week of January. The following are the stages
Stage1 - September, October
Stage2 - November, December
Stage3 - January, February
Stage4 - March, April
The dlmModSeas captures this seasonality very well. But what do I do to forecast an off season wave that has the same stages as above. Say it starts in May and it peaks at end of August or early September. I am able to get the information of this off season wave from the user during the start, i.e. in May. How do I introduce this change in seasonality?
2) Is there a better way to do this forecasting? Please Advise