# Gaussian assumption in Kalman filter

I have a question about the Gaussian assumption of Kalman filter in detail. I'll lay down some equations first

Assuming $x_{t|t-1}$ is your prediction of the state space at time $t$, then the innovation

$v_t = z_t - H_t\,x_{t|t-1}$, where $z_t$ is the measurement at time $t$ and $H_t$ is the mapping

Then we do the actual update

$x_{t|t} = x_{t|t-1} + K_t\,v_t$, where $K_t$ is the Kalman gain

And my question is:

If I set up some parameters and run the Kalman filter and check my assumption posteriorly, do I check distribution of the innovation $v_t$ or the distribution of $z_t - H_t\,x_{t|t}$ instead

I haven't seen the expression $z_t - H_t\,x_{t|t}$ mentioned anywhere, but to me this should represent the measurement error, while the innovations should not

Any comment is very much appreciated

The Gaussian assumption is used in the predict and update steps of the Kalman Filter. They are the reason you only have to keep track of means and variances.

First, $Z_t|X_t$ is Normal. Second, $X_t|Z_{1:t-1}$ is Normal. Then, by Bayes' theorem, $$p(x_t|z_{1:t}) \propto p(z_t|x_t)p(x_t|z_{1:t-1})$$ is Normal. Then the process begins again. You don't need to bother with the normalizing constant, because you will recognize this as a Normal distribution. All you have to do is find the mean and variance of the distribution on the left hand side. For more information on connecting this idea to your Kalman Gain and updating arithmetic, see https://en.wikipedia.org/wiki/Multivariate_normal_distribution#Conditional_distributions

## Checking Assumptions:

There are probably many ways to check the normality assumption, but I would check the innovation. Especially if your goal is prediction. Note that $$p(z_t|z_{1:t-1}) = \text{Normal}(z_t;H_t x_{t|t-1}, P_{t|t-1}) \tag{1}.$$ So if the model is true, then you can plug your observations into the predictive density, and you can expect to get high densities more often than not. A bunch of techniques probably play on this idea. Here are just a few I can think of off the top of my head.

## 1.

Call $F_t(\cdot)$ the cdf of (1). Then, if the model is true, $F_t(z_t) \sim \text{Uniform}(0,1)$. If these don't look uniform you have a problem.

## 2.

At every time step calculate $n_t = -\log p(z_t|z_{1:t-1})$. High values are "bad." If your model is true, $\sum_{t=1}^N{n_t}/N$ should converge to the Entropy of a normal distribution, by the law of large numbers.

## 3.

Look at the square of the z-score of your prediction. Calculate $(z_t - H_t x_{t|t-1})'P_{t|t-1}^{-1}(z_t - H_tx_{t|t-1})$. If your model is true, then this quantity should follow a chi-square random variable with degrees of freedom equal to whatever the dimension of your observations are.

Note: you might want to test residuals from filtering on out of sample data. Otherwise, I'm not sure if these convergence arguments are valid; you would be using the data twice.

• Thank you. This make a lot of sense. If I understand correctly, to estimate the measurement error covariance matrix $R_t$, I should compute this by taking the sample covariance of the innovation $v_t$ and pass into the optimizer, correct? – Will Gu Feb 9 '17 at 22:44
• @WillGu there is no need for the optimizer anywhere in this answer. Look at (1). Say you see a new data point at time $t$. Before you update with the Kalman update formula, plug this value into a normal CDF function. The mean and variance of this normal CDF are given on the right hand side of (1) – Taylor Feb 9 '17 at 22:54
• Sorry I sidetracked it. I was looking at multiple posts and came up with this random follow-up question. So regardless of the context of this question, i wonder if that's the right way to get $R_t$. Thank you. – Will Gu Feb 9 '17 at 23:13
• Is $R_t$ the same as $\text{Var}[z_t|z_{1:t-1}]$? If yes, then this is a (deterministic) function of the parameters of your model, which you are assuming you know (because how else can you run a Kalman filter). So $R_t$ is decidedly not something to guess at or estimate. – Taylor Feb 9 '17 at 23:15
• $R_t$ is the one that's used in generating the Kalman gain. $K_t = P_{t|t-1}\,H_t^T\,(H_t\,P_{t|t-1}\,H_t^T + R_t)^{-1}$. I guess in real-life application, sometimes the $R_t$ is not pre-defined, meaning you don't really know your measurement error covariance matrix. How would you go about it in this case? Would you make simplified assumptions about $R_t$. I've seen people say choosing $R_t$ and $Q_t$ are a bit of art than science. By the way please feel free to move this conversation to the discussion channel. – Will Gu Feb 9 '17 at 23:27

Multivariate Gaussian distribution has really great property that any conditional distribution is also Gaussian. That means, for any pair $(Z_i,Z_j)$ of variables, you can write $$Z_i = AZ_j+Y$$ where A,B are constant and $Y$ is a normal random variable that is independent of $Z_j$. That is, instead of fully characterizing the conditional distribution, you can simply represent everything in linear form and that makes the Kalman filter so convenient and powerful.

Without Gaussian assumption, you won't be able to characterize $x_{t|t}$ with a single linear equation.

[EDIT] Checking Gaussian assumption could be simple. First, you can visually check the QQ plot of the normalized innovation vs standard normal. If they're off by a lot, then you'll know that the assumption is not valid. More formally, you can apply various tests on normality. There are bunch of them out there, Shapiro-Wilk / Jacque-Bera / Kolmogorov-Smirlov to name a few.

• Thank you for your prompt answer. I might have mislead you in the original question, but my real question is what values I should look at to validate the Gaussian assumption posteriorly, or if I need to validate at all. – Will Gu Feb 9 '17 at 21:58
• How do you do a QQ plot when your observations are vector-valued? – Taylor Feb 9 '17 at 22:56
• Qq plot for each variable? Basically checking marginals. If your marginals are not normal, there is no chance that the vector itself is jointly normal. – Julius Feb 9 '17 at 23:22