# Time Varying System Matrices in Kalman Filter

Kalman filter can accommodate time varying system matrices. Equations to run the filter are the same and it preserves its optimality under linear gaussian model.

My question is the following:

Can the evolution of time varying system matrices be stochastic? In some references I seem to read between the lines that they should evolve deterministically. Does it mean that the entire filter breaks or do we simply lose optimality by making them stochastic?

For reference, please peek at section 3.2 of the following paper:

http://www.ims.cuhk.edu.hk/~cis/2012.1/CIS%2012-1-05.pdf

A similar comment is in Harvey's book on Kalman Filter.

• The link does not work, can you add a full reference to the paper? – Juho Kokkala Jun 28 '17 at 18:02

If your dynamic system is $$x_t = A_t x_{t-1} + \eta_t$$ $$y_t = B_t x_t + \varepsilon_t$$ Then when people say system matrices $A_t, B_t$ should be deterministic, this means that Kalman Filter gives you an estimate of state $x_t$ conditional on past and current values of parameters $$\mathbf E\left(x_t|\,y_t,\dots,y_1, \,A_t,\dots,A_1, \,B_t, \dots, B_1\right).$$
So when you do a filtering step to estimate this conditional expectation of state, you consider those matrices to be already known (observed) rather than unknown and random. Of course they can be realizations of some external random process (which is often the case) or be deterministic functions of time - this doesn't matter much.

What seems authors in above paper describe in 3.2 is an extension of KF when they assume $A_t, B_t$ to be random but they don't what to condition on their values when filtering. So they don't assume matrices to be known at the moment of filtering, but rather assume that they come from a distribution with known mean/variance.

• So basically they can be stochastic but if they are known (already observed) at the time of filtering step then it is still OK. Did I understand it correctly? This was indeed my intuition but I couldn't put my finger on it. In that case my only concern is how come this filter going to converge to anything useful. If matrices are evolving deterministically it could track the dynamic evolution (smooth derivatives). But when stochastic (no derivatives, zigzags) even if the values are known it should throw off the filter. No? – Cagdas Ozgenc Nov 3 '13 at 10:12
• If the Matrices are observed, does it mean the filter is still an optimal filter? – Cagdas Ozgenc Nov 3 '13 at 11:04
• Yes, when matrices are fixed at the moment of filtering, then standard KF produces the true value of above expectation of state conditional on all so far observed data (of course, if you specified the model correctly). And conditional expectation is a mean-squared optimal estimate of current state (which is a random value). – Kochede Nov 3 '13 at 12:15
• In both cases the "path" of system matrices is deterministic by the moment of filtering, just if it was a realization of some random process, then it will be non-smooth, if it's a deterministic function of time - it may be smooth (or not). What matters is that you know the whole path till $t$ when you filter at $t$. – Kochede Nov 3 '13 at 12:19
• Note, that filter does not "track" the path of system matrices as you mention above, that path is already known. it tracks the unknown path of states. When you say "filter converges" what do you mean? – Kochede Nov 3 '13 at 12:23

Can the evolution of time varying system matrices be stochastic?

Yes. If your model is $$x_t = A_t x_{t-1} + \eta_t$$ $$y_t = B_t x_t + \varepsilon_t$$ and you assume further that $$A_t$$ and $$B_t$$ are themselves latent Markov processes, then you might have a model amenable to particle filtering, and in particular Rao-Blackwellized or marginal particle filters. Using these, it will be possible to obtain sampling-based approximations to distributions of the form $$p(x_{t} \mid y_{1:t}),$$ which would be considered a marginal of the filtering distribution. You wouldn't have to condition on unknown quantities such as $$B_t$$ or $$A_t$$.

I have some fast c++ code that will allow you to obtain the filtering distributions for models with pretty general dynamics on the "system matrices." Subclass rbpf_kalman with your own model, and all of the functionality is there ready to go.