Estimating Noise Covariances When Tuning a Kalman Filter
Summary
The discussion explains that choosing the process-noise covariance Q and observation-noise covariance R is an estimation problem, with no universally exact setting for financial data. One suggested route is to fit covariances through least-squares techniques, including autocovariance least squares. Maximum likelihood is another option for a linear Gaussian state-space model: the Kalman filter produces innovations, whose Gaussian likelihood can be optimized over the parameters. An expectation-maximization procedure is also mentioned, though it involves smoothing.
An adaptive alternative iterates between filtering and covariance estimates until they stabilize. The appropriate state equation and covariance calculations depend on whether the data are stationary. Particle filters can relax some Kalman filter assumptions, but the discussion warns that parameter fitting with them is difficult and that particle filtering can be computationally expensive for real-time use. These are methodological suggestions, not a worked tuning example; the best choice still depends on the process being modeled and its distributional properties.
Key ideas
- Noise covariance settings should be estimated for the modeled process rather than assumed to be exactly knowable.
Tags
Full text
# How to tune Kalman filter's parameter?
# How to tune Kalman filter's parameter?
I plan to use Kalman filter to estimate saving account amount.
However, I'm a bit lost at how to tune the filter's parameters.
Taking as the example from the Wikipedia page, basically there are three parameters.
P(0) can be set as (L, 0; 0, L), where L is a big number. This is fine, anyway P(k) shall converge.
R supposedly is a constant; it's suggested to be taken as covariance of z. Fine, thought Z is composed of x and v.
How about Q? From An Introduction to the Kalman Filter by Greg Welch and Gary Bishop, different values of Q seems seriously affect the converge of estimation.
Any suggestions on how to tune Q?
## Answer by Matt Wolf (score 8, accepted)
https://quant.stackexchange.com/a/8512
Estimation of the initial states of R and particularly Q is indeed more of an art than science. The task at hand is to estimate the covariances. You have basically two main choices:
- Live with the fact that you will never be able to exactly pinpoint the covariance of noise in financial time series. The most often used approach is to pose the coveriance estimation as a least-squares problem, such as using ALS. Below ALS and a few related solutions to the problem. However, what makes your problem a lot easier is that you apply Kalman filters to a savings account. I do not know which exact method you use to model a savings account or what distributional properties it has. However, it looks and sounds a lot easier than applying Kalman filters to financial time series with potentially several Brownian motion components. A savings account "process" may have much more straight forward covariances which you can equip Q with.
Autocovariance Least-Squares (ALS) Package
A new autocovariance least-squares method for estimating noise covariances
A generalized autocovariance least-squares method for Kalman filter tuning
- Another solution is to relax the distributional assumptions that underlie Kalman filters and focus your efforts on techniques such as Particle Filters. I have to great success implemented Particle Filters in financial time series tracking as well as forecasting. However, a word of warning is that particle filter algorithms are extremely computationally expensive and hence they may not be applicable to real-time applications.
## Answer by Taylor (score 3)
https://quant.stackexchange.com/a/18089
If you have a linear/gaussian state space model and you're using a Kalman Filter, you can use maximum likelihood estimation or the EM algorithm. I personally prefer the former since you don't need to know anything about smoothing. If you use the EM, you do.
If your observations are $z_1, \ldots, z_n$, then you can write down an innovations likelihood $$L(\theta) = \prod_{t=1}^n p(\epsilon_t; \theta) $$ where $\epsilon_t = z_t - E(z_t|z_1, \ldots z_{t-1})$. Each $p(\epsilon_t;\theta)$ is Gaussian, and you can get them from a kalman filter iteration. However, they're usually really nonlinear in $\theta$.
Learning/fitting with particle filters is very difficult since you can't evaluate $L(\theta)$. Fortunately for you, it seems to be irrelevant. You don't need them in the linear gaussian case.
## Answer by Amanda G. (score 2)
https://quant.stackexchange.com/a/33426
A good article on adaptive Kalman filter tuning is:
Introduction to the Kalman Filter and Tuning its Statistics for Near Optimal Estimates and Cramer Rao Bound
The authors present an adaptive approach, which means that you make initial estimates of the noise covariances, and iterate the Kalman filter and the noise covariance estimates until all the parameters converge to fixed values.
Something to be aware of is whether your data is stationary or non-stationary. If stationary, you have to use a different state equation than in the non-stationary case, and this affects the calculation of the noise covariances and initial state and state covariance.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.