# Style analysis and Kalman Filter

I am trying to implement a code that uses Kalman filter to improve the performance of traditional style analysis. I have come across a paper called "Return based style analysis with time varying exposures" (can be found here) which has proved to be quite helpful. I have read some chapter from various book on the Kalman filter and now I have to implement it in Matlab. I am correct that the state equation is the one where I write process for the beta (for example an AR(p)) and the measurement equation the one where I regress the fund's returns on the factor returns? Does anyone know any source where impleting Kalman filter on Matlab has been done before? Davide

• Sounds interesting- could you maybe elaborate a bit more, especially what you have tried so far? – Kermittfrog Jan 20 at 20:40
• yes, generally the 'state equation' would refer to the evolution of the latent parameters, the $\beta$ in your case. These should have some simple form (e.g. betas are a random walk with some fixed variance of innovations, or betas are a random walk with a mean-reverting term, etc.). The 'measurement equation' would describe how the underlying state affects what you observe. In your case, it should be something simple like $y=\beta' x + \epsilon$, where you observe the $x, y$. Typically the hard part of Kalman analysis is estimating the scales of errors (in the $\epsilon$ and random walk). – steveo'america Jan 21 at 0:16
• First I have tried to model with Matlab packages (it.mathworks.com/help/control/ug/kalman-filtering.html) but I have some difficulty to compare the results with a traditional style analysis. As a measure of "how well the style analysis works" I am using the MAD and MSD described in the paper. I tried to implement the filter myself going through each equations but I have some doubts; for example Kalman filter requires initial values of β and I am able to see which values it should have at the beginning of the process. Is there any book you could recommend with code example? – Davide Martintoni Jan 21 at 20:25