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.