Kalman Filter
by JS
I had to implement a Kalman Filter as part of a class project recently. Well, strictly speaking, I didn’t have to, but this is a “simple” and well known algorithm so I thought it would be useful. Also, examples of Kalman Filters online are often only one-dimensional.
Anyway, you can find the code here, or check the sidebar.
Heres a picture of the results:

The red line shows the true path of the wandering object. The blue crosses are noisy observations of the objects position, and the green state estimates are the filtered estimates. You’ll notice that the filtered estimates don’t vary as much as the observations, indicating that the filter really is factoring out some of the observation noise.

Comments
can I use this to estimate stock price direction?