"State Space" + "Kalman Filter "

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

"State Space" + "Kalman Filter "

nserdar

I analyzed the kalman filter based approaches like mean reverting, random coefficient and random walk.

At this point Automatic package is inadequate and need some constraints. I also found Kalman Filter code

in Shumway$Stoffer book, but it did not provide the correct optimization.

Can you suggest any R codes for kalman filter based approaches?

Regards,
Serdar
Reply | Threaded
Open this post in threaded view
|

Re: "State Space" + "Kalman Filter "

Giovanni Petris
Package dlm does it, as well as other contributed packages (KFAS, sspir, dse,...)

Best,
Giovanni
________________________________________
From: [hidden email] [[hidden email]] on behalf of nserdar [[hidden email]]
Sent: Thursday, October 18, 2012 8:40 AM
To: [hidden email]
Subject: [R] "State Space" + "Kalman Filter "

I analyzed the kalman filter based approaches like mean reverting, random
coefficient and random walk.

At this point Automatic package is inadequate and need some constraints. I
also found Kalman Filter code

in Shumway$Stoffer book, but it did not provide the correct optimization.

Can you suggest any R codes for kalman filter based approaches?

Regards,
Serdar



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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: "State Space" + "Kalman Filter "

nserdar
I know these package but I plan to analyse  financial multi factorial data set, and also estimate diffuse initial values for these
models.

I generated my own code, but I had problem with optim() package problem. I need some constraints and I do not apply it
in my code.

Do you have any suggestion about these problem?

Regards,
Ser
Reply | Threaded
Open this post in threaded view
|

Re: "State Space" + "Kalman Filter "

nserdar
In reply to this post by Giovanni Petris
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