# [R] "State Space" + "Kalman Filter "

nserdar snes1982 at hotmail.com
Thu Oct 18 21:02:16 CEST 2012

```So I do not find example what I expect.

I plan to estimate the multi-factor model for Kalman Filter Mean Reverting,
Random Walk and Random Coefficient.

For example:

R(it)= Alpha(it)+ Beta(it)R(mt)+Gamma(it)(R(mt)^2)+delta(it)(R(mt)^3)+ V(it)

KF Random walk

Alpha(it)= Alpha(it-1)+W(i1t)
Beta(it)= Beta(it-1)+W(i2t)
Gamma(it)= Gamma(it-1)+W(i3t)
Delta(it)= Delta(it-1)+W(i4t)

Note:  (alphabar= Mean  Alpha,  Betabar= Mean Beta, Gamma= Mean Gamma,
Deltabar= Delta Mean)

KF Mean Reverting

Alpha(it)= Alphabar(i)+ phi* (Alpha(it-1)-Alphabar(i))+W(i1t)
Beta(it)= Betabar(i)+ phi* (Beta(it-1)-Betahabar(i))+W(i2t)
Gamma(it)= Gammabar(i)+ phi* (Gamma(it-1)-Gammabar(i))+W(i3t)
Delta(it)= Deltabar(i)+ phi* (Delta(it-1)-Deltabar(i))+W(i4t)

Kf Random Coefficient

Alpha(it)= Alpha bar(i)+ W(i1t)
Beta(it)= Beta bar(i)+ W(i2t)
Gamma(it)= Gamma bar(i)+W(i3t)
Delta(it)= Deltabar(i)+W(i4t)

Step 1)  Maximize MLE to estimate initial values (etc: Alphabar, ...., Delta
bar,  Variances of State equation Error, Observation Error,..... etc... ) (
I also use L-BFGS-B methods to optimization but I failed. :( )

Step 2) Apply estimated values from step 1  in Kalman Filter to filtering.

Then obtain MSE etc ( I can calculate by myself)

Please let me know whether I can follow these steps in DLM package or not.

Regards,
Ser

--
View this message in context: http://r.789695.n4.nabble.com/State-Space-Kalman-Filter-tp4646615p4646675.html
Sent from the R help mailing list archive at Nabble.com.

```