Understanding the dlm package in r
I am trying to forecast a monthly time series using the R package dlm. I am reading through the vignette and have a few questions. Regarding the forecasting of the UKgas data I see
dlmGas <- dlmModPoly() + dlmModSeas(4)
the 4 is the quaterly format of the series, so for a monthly series, should I use dlmModSeas(12) instead?
Also for the functions
diag(W(dlmGas))[2:3] <- exp(x[1:2]) V(dlmGas) <- exp(x)
what are these numbers and how are they chose? also how would this look different for a monthly series?
To the first question: I think dlmModSeas(12) is correct for monthly data. And if you execute in R the command:
dlmModPoly() + dlmModSeas(12)
and look at the matrix W you see, that still only the second and the third diagonal elements are different from zero.
I suppose the diag(W(dlmGas)) refers to the system noise variance of the trend component (dlmModPoly()) and diag(W(dlmGas)) to the system noise variance of the seasonal component (dlmModSeas(12))
So, as I understand it, increasing the number of seasons does not increase the diagonal elements of W to be estimated.