I have started coding a Kalman filter in R. I am using dlmModreg to build an object of class dlm, which I am planning to use as my input to dlmFilter. But, I am stuck in the dlmModreg step itself. I am providing the parameters for dlmModreg as described in 1. This is my code
linear.reg <- lm(y.learn$hospitalizations ~ y.learn$google); flu.model <- dlmModReg(y$google,dV=25.66,dW=0.001016);
I get the following error
Error in dlmModReg(y.learn$google, dV = 25.66, dW = 0.001016) : Inconsistent dimensions of arguments
For dV I used the residual variance obtained from the linear model(linear.reg) However, this error vanishes when I remove dW.
Also if I change my code as
dlmModReg(y.learn$google, dV = 25.66, m0 = 0.023711, c0 = 0.001016)
I get the error below
Error in dlmModReg(y.learn$google, dV = 25.66, m0 = 0.023711, c0 = 0.001016) : unused argument(s) (c0 = 0.001016)
Here m0 is the Beta(google) estimate and c0 is the Beta(google) variance.
I am not sure what is the right value to be used for parameters dW, dV, m0, c0?