9

I am having some trouble debugging an application of a linear discreet Kalman Filter. From time to time, I find that there are diagonal elements of the covariance matrix that become negative. This is clearly erroneous and causes the whole filter to blow up.

What are the possible causes and remedies for this problem? I know there is a known issue with rounding errors if the error measurement update is expressed as

$P^t = (I - K_tH_t)P^{t-1} $

and so I have implemented this, as suggested in several sources, as

$P^t = (I - K_tH_t)P^{t-1}(I-K_tH_t)^T + K_tR_tK_t^T $

which is supposed to be the sum of two positive definite matrices, ensuring that $P^t$ is positive definite. In my case, this isn't so. The elements go negative not by small, rounding errorish values, but by comparable values to the positive elements.

My Kalman Filter implementation has been pretty battle hardened by this point so I don't think there are any glaring bugs. I haven't encountered this problem before. I am playing around with a new dataset which is causing these errors.

The main suspect at this point that I can come up with is that fact that at times, entire columns of the $H_t$ matrix can be zero. Recall that $H$ is defined as

$z_t = H_tx_{t-1}$

where $z$ are the measurements and $X$ the state vector. As I say, sometimes whole columns of $H$ are zero, meaning that there are no measurements that contain any information about some particular state in the measurements for the given timestep. This may be an issue, but on the other hand I would hope that the filter would simply leave that state unchanged, and add a bit of process noise to its variance, without having any major dramas. I feel like this situation must have happened before with some other datasets without any ill effect.

Where else could I look to see where the problem is emerging? The $H$ matrix contains negative values, but that should not be an issue. $K$ also is negative at times, however following through the logic of the Filter construction, the negative elements in $H$ that led to negatives in $K$ should cancel back out in the error measurement update step. Clearly that isn't happening though.

Are there any standard approaches to ensuring the robustness of a Kalman Filter that I need to employ here, or any other suggestions on where to look to find the cause?

Bogdanovist
  • 6,059
  • 1
  • 23
  • 28
  • Whether or not it's the root of your problem (probably not, actually) interpreting a *lack of observation* at a time point as the same thing as a *full observation of all zeros* would seem to be a bad idea and will not do what you want. – conjugateprior Feb 21 '13 at 11:13
  • Probably you have a round-off problem. The standard solutions are square root or information filter reformulations. Most state space time series books should cover them. – conjugateprior Feb 21 '13 at 11:17
  • @conjugateprior I must not have been clear. I'm not interpreting no observations as zero, the H matrix does not correspond to observations but encodes the linear model that connects the data and observations. A column being all zero simply means one of the states in the X vector plays no role in explaining any of the measurements in z. – Bogdanovist Feb 21 '13 at 22:48
  • Then I did misunderstand, though it's slightly possible a similar point goes through from the other direction: My point of reference is sec 6.4 of Shumway and Stoffer where the line is that zeroing out bits of H works as long as unobserved data points are also replaced by zeros and the observation covariance matrix has the identity matrix at the parts corresponding to missing data. – conjugateprior Feb 22 '13 at 09:30
  • On the 'debugging' side it might be useful to run your analysis in another package to see if that blows up too. Maybe try the R package **astsa** since that does missing data nicely. If it blows up too, that's not the problem and you could move to a square root KF. – conjugateprior Feb 22 '13 at 09:54

0 Answers0