I'm trying to use a Kalman-filter for some kind of anomaly detection. But I think that maybe I have misunderstood something fundamental about the filter. I'm following this "guide".
I'm using the filter in one dimension. It is my understanding that the filter estimates the mean of the state variable x and updates this mean whenever it is given a new measurement z. Moreover it gives an uncertainty p of the estimate and updates this whenever it is given a new measurement. So as I understand it, whenever the estimates are computed I have a model: a normal distribution with the current estimated mean as mean and the current sqrt(p) as standard deviation. And this normal distribution gets updated with every new measurement.
So my question is: can I directly translate the estimate uncertainty to the standard deviation like I do, or doesn't this p have anything to do with the standard deviation?
And if so, how come the estimate uncertainty gets smaller (or the same) in every iteration? I do mathematically understand why, but not why the filter has to behave this way. Say we have some measurements which is normally distributed with mean 7 and standard deviation 1 which suddenly change to a normal distribution with mean 7 and standard deviation 5, just like this figure: If the estimate uncertainty can be translated to the standard deviation of the current normal distribution I would expect p to gradually get bigger when we get to the data with higher variance. But that is not the case: it keeps decreasing. So my only conclusion is that this p doesn't have anything to do with the standard deviation. Is that correct? But then what does p express? In this case, how can I then track the variance as well as the mean, and update it in each iteration?