# [R] Kalman filter

David Stoffer dsstoffer at gmail.com
Tue Nov 23 06:35:11 CET 2010

```It sounds like you've looked at the DLM, DSE, and SSPIR packages.  If not,
then certainly check them out.  Also, we have code for filtering, smoothing
and estimation in our text- go to www.stat.pitt.edu/stoffer/tsa3/ and look
at the code for chapter 6.  There's not a package for the text, but all the
code is in a compressed file that you can download.  The examples are
discussed in detail in the text, but I think looking at the code (and
Appendix R on the site) will be sufficient to set up your problem.

David

Garten Stuhl wrote:
>
> Hello,
>
>
>
> I have completed my kalman filter problem with more details.
>
>
>
> The transition- and the measurement equation is given by
>
>
>
> x[t]=A[t]*x[t-1]+B[t]*epsilon[t]
>
> y[t]=C[t]*x[t]+eta[t]
>
>
>
> A, y, B and C are Matrices. Y[t] is the data input vector with 800
> elements
> (every t has one element)
>
>
>
> My Model is described by the following
> (discretisation<http://www.dict.cc/englisch-deutsch/discretisation.html>)
> stochastic differential equation
>
>
>
> Lambda[t]=lambda[t-1]+kappa*lambda[t]*delta_t+epsilon_l
>
> R[t]=R[t-1]+mu*delta_t+epsilon_r
>
> epsilon_l=sigma_l*sqroot(delta_t)
>
> epsilon_r=sigma_r*sqroot(delta_t)
>
>
>
> Ln(S[t])=lambda[t]+R[t]
>
>
>
> The paramters for estimation are:
>
> kappa
>
> mu
>
> sigma_l
>
> sigma_r
>
>
>
> The state-space-model for this problem is:
>
>
>
> x[t]=(lambda[t], R[t])’
>
> A[t]=(1-kappa+delta_t, 0; 0, 1+mu)
>
> B[t]=(1,0;0,1)
>
> epsilon[t]=(epsilon_l, epsilon_r)’
>
> C[t]=(1,1)
>
> Eta[t]=0
>
>
>
> I used serveral alternative methods (dlm, kalmanLike, fkf, kfilter) for
> parameter estimation but I don’t understand the syntax and the correct
> input
> for model estimation.
>
>
>
> Can anybody help me, which packed is the most best for my problem and how
> is
> it to control?
>
>
>
> Thanks for helping.
>
>
>
> Best,
>
> Thomas
>
> 	[[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help