Skip to content
All library documents

Kalman Filtering for Price Means and Variance Estimates

Article Quant Q&A · Author: Mike

Summary

The document examines whether a basic Kalman update can estimate both the evolving mean and the variability of a price series. It presents a recursive mean update using the Kalman gain, with a filtered state variance that shrinks when the gain is below one. The author questions whether this shrinking variance can represent price dispersion, since it seems instead to express growing certainty about a fixed quantity.

The responses clarify that filtered variance is distinct from predicted variance: the prediction step can add process uncertainty, so variance need not keep declining. They also stress that the model must specify a plausible state process and measurement equation; a suggested alternative models price reverting toward a latent mean. Measurement error may need to vary with market volatility and show serial dependence. The discussion is conceptual and does not provide a complete fitted model or empirical validation.

Key ideas

  • The displayed Kalman update treats price as a measurement of an evolving mean state.
  • Filtered state variance can shrink even when it does not measure price-series dispersion.
  • The prediction step can add uncertainty, so predicted variance need not decline over time.
  • A useful model requires explicit state dynamics and a measurement equation.
  • Measurement error for prices may need to reflect changing, autocorrelated volatility.

Tags

Full text
# Mean and standard deviation of price series with Kalman


# Mean and standard deviation of price series with Kalman












I like to calculate the mean and standard deviation of a price series, using the Kalman filter. I am somehow stuck with the deviation, or have some problem in understanding, which my research could not solve.

```
mean(t) =  mean(t-1) + K(t) * ( price(t) - mean(t-1) )
```

with Kalman gain `K(t) = R(t-1) / (R(t-1) + Ve)`, state variance `R(t) = (1 - K(t)) * R(t-1)` and measurement error `Ve` practically as some pre-defined parameter, similarly to the lookback period in a simple mean.

I've read a few times that the variance `R` should give kind of variance (and thus standard deviation) of the price series. But with a `K < 1`, `R` with every iteration just gets smaller and is no way the deviation of the price series. This only would make sense for a constant value to measure, where with every measurement iteration we get more certainty. Is my concept of the Kalman filter too simplistic? Can anybody give me a hint please.

## Answer by Will Gu (score 3)

https://quant.stackexchange.com/a/33928

I would suggest check out the Wikipedia page first and use more stylized notations.

In your update equation `mean(t) = mean(t-1) + K(t) * ( price(t) - mean(t-1) )` you are basically saying that your state process is `mean(t)` and `price(t)` is a measurement of `mean(t)`. This doesn't sound legit

On the other hand, you could have a mean reverting process $$\text{price}(t) = \text{price}(t-1) + \alpha (\text{mean}(t-1) - \text{price}(t-1))$$

Although it looks similar, it's fundamentally different from the update equation in Kalman filter.

Then the state vector for this process could be $X_t = \begin{bmatrix}\text{price}(t) \\ \text{mean}(t) \end{bmatrix}$ and state transition equation could be $$\begin{bmatrix}\text{price}(t) \\ \text{mean}(t) \end{bmatrix} = \begin{bmatrix} 1-\alpha & \alpha \\ 0 & 1 \end{bmatrix} \begin{bmatrix}\text{price}(t) \\ \text{mean}(t) \end{bmatrix} + \begin{bmatrix}\epsilon_1(t) \\ \epsilon_2(t) \end{bmatrix}$$

Denote $F_t = \begin{bmatrix} 1-\alpha & \alpha \\ 0 & 1 \end{bmatrix}$ then the above equation is simply $$X_t = F_tX_t + \epsilon_t$$

The measurement equation could be

$$Z_t = H_tX_t + \nu_t$$

where $Z_t$ is the acutal price series and $H_t = \begin{bmatrix} 1 & 0 \end{bmatrix}$

The you can use the Kalman filter two-step recursion to estimate the `mean(t)`

## Answer by hotsource (score 2)

https://quant.stackexchange.com/a/33926

Rt in your notation is "filtered" variance R(t|t). The prediction of variance R(t+1|t) adds another term which is not guaranteed to be decreasing overtime.

I think another critical assumption is Ve in your equation. How do you define Ve? For price series Ve as a proxy for volatility makes sense to be time-varying, and probably exhibit some auto-correlation.

## Answer by rrg (score 0)

https://quant.stackexchange.com/a/30353

You need to run over the times series once for initial variance, and a second time with updated Kalman params for the state variance (your Rt). This is two step recursion

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.