# How to estimate parameters for a Kalman filter

In a previous question, I inquired about fitting distributions to some non-Gaussian empirical data.

It was suggested to me offline, that I might try the assumption that the data is Gaussian and fit a Kalman filter first. Then, depending on the errors, decide if it is worth developing something fancier. That makes sense.

So, with a nice set of time series data, I need to estimate several variable for a Kalman filter to run.

(Sure, there is probably an R package somewhere, but I want to actually learn how to do this myself.)

The usual method is to use Maximum Likelihood Estimation. Basically, you need a Likelihood function and then run a standard optimizer (such as optim) to maximize your Likelihood.