0

In a post by @vdesai he/she explained a kalman filter model (See the full post here: Unsmoothing returns). The model described below is taken from there.

State-Space model and formulas

I've looked at the FKF package in R but I've not been able to make sense of how the parameters in the model translates to the inputs in fkf.

Note that I only have the observations (y(t)) and the index return (R,I(t)). I would like to know the true returns (z(t)) and the weigths (w0,w1,...,wp)

Community
  • 1
  • 1
dcez
  • 21
  • 3
  • Have you explored other packages? –  Feb 03 '16 at 14:08
  • I've looked at the KFAS package (this is only more confusing) and the KFKSDS package but still don't really understand it. The KF function in the latter package seems easier but is still hard to understand. – dcez Feb 03 '16 at 15:17
  • The code for this kalman filter is very simple - basically it's shown completely in the Matlab documentation [here](http://de.mathworks.com/help/control/examples/kalman-filter-design.html) (go to section "Time-Varying Kalman Filter Design", 2nd code field). All you would need to do is to rewrite the for loop to R. Also take care that matrix operators look different in R. – bdecaf Feb 04 '16 at 12:48
  • @bdecaf Matlab is also fine. I've looked at that example but in this case we have y(t) and are missing z(t). I would like to know the vector z(t) and C. Also, I guess it would look differently since we have B as well. – dcez Feb 04 '16 at 13:16
  • no this is exactly the solution for calculating z(t) from y(t). B is treated in the block '% Time update'. Since you can use matlab just have a look how this example calculates x (which has the same role as y in your formula). Are you sure you don't have C? one can't really write A and B and not know this. – bdecaf Feb 04 '16 at 14:10
  • I think I understand what you mean now. I only looked at the second part (Time-Varying...) so I missed where they introduced the noise terms u and w. So if I got it right, I should define u,v and w as the example in the first part, and then continue from the second part. And yes, if you look at the model we don't have C or B (in addition to missing z) – dcez Feb 04 '16 at 14:40
  • [This](http://se.mathworks.com/help/control/ug/kalman-filtering.html) also shows how to implement a time-varying kalman filter but they depend on known values on B and C in the model. – dcez Feb 05 '16 at 09:25

0 Answers0