Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Could anyone show how this could be done in R? The dlm package seems to be a good start, but I can't really find any good examples to learn from.

Currently I have two timeseries of the closing prices for two stocks. I then do a rolling regression that gives me the corresponding timeseries of the beta between the two stocks.

How would I go about to implement a Kalman filter for this beta?

share|improve this question
up vote 4 down vote accepted

Have you checked out the vingette for DLM by Petris?

Incidentally, Petris also has an R-book on the DLM package which includes estimation of beta as an example.

share|improve this answer
That's seems to be a nice book to reference. I found these two pdfs explaining kalman filtering too: first, second – c00kiemonster Nov 11 '11 at 0:33
If you want to learn Kalman filtering in general I think a good text is Rene Carmona's Statistical Analysis of Financial Data: amazon.com/Statistical-Analysis-Financial-Data-S-PLUS/dp/… – Ram Ahluwalia Nov 11 '11 at 1:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.