Kalman filter on random walk in dlm

How would I go about setting up a dlm model, which I eventually would like to apply a Kalman filter on? I tried the following:

y <- # finance or GDP data    
myMod = dlmModPoly(order = 1, dV = 0.8, dW = 1.0, C0 = y[1]) 
# not sure how to set the coefficients but this seems to work, more or less

arima <- auto.arima(y)
myMod <- dlmModARMA(ar= arima$coef, sigma2 = arima$sigma2) 
# this one straight up does not work when applied to the filter

output <- dlmFilter(y, myMod) # Kalman Filter

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.