baggepinnen/LowLevelParticleFilters.jl

Particle filter with second order Markov model

danscr opened this issue · 3 comments

danscr commented

Is it possible to model the dynamics of a particle filter as
$$x_t = a_1 x_{t-1} + a_2 x_{t-2} + noise,$$
where $a_i$ are weighting factors fulfilling $\sum a_i = 1$?
I assume it should be possible to have the state be a vector $[x_{t-1}, x_{t-2}]$, but this creates quite some redundancy.
Is there a way to access the previous state from within the dynamics function?

Having $[x_{t-1}, x_{t-2}]$ be the state vector is indeed the way to go. This does not introduce much redundancy other than in memory, the full dimension of the state is indeed given by 2 times the dimension of $x$, and this is what determine the statistical properties regarding how densely the state space is sampled etc.

There is no way to access state older than the last step, the definition of state is the complete set of information that is required to predict the future, hence, $x_t$ is technically not a valid state representation in the system
$$x_t = a_1 x_{t-1} + a_2 x_{t-2} + noise,$$

One could implement a custom particle filter to handle this case if the use of memory becomes a bottleneck, but his would have to special case not only the dynamics update, but also handling of the initial state etc. since you'd need multiple past values of $x$ to initialize the filter.

A further complication would be in the resampling step, since it would not be enough to resample the current value of $x$, you'd have to also copy over the history of $x$ in the resampling step.

BTW, this model is linear, is the noise Gaussian? If so, I'd use a Kalman filter instead

danscr commented

Thanks for the explanation! I'll then proceed as you suggested.
The noise in my current dynamics is not always Gaussian, since I have some parameters constrained to certain intervals. But later on I might simplify my model to be able to use Kalman filter.

Cool, I'll close this issue for now, feel free to continue the discussion if you have further questions :)