pints icon indicating copy to clipboard operation
pints copied to clipboard

Kalman filter log-likelihood

Open martinjrobins opened this issue 7 years ago • 0 comments

For an electrochemistry project I would like to try a kalman filter to estimate a model parameter that varies over time. I would like to incorporate this into pints by writing a log-likelihood class that uses a kalman filter to calculate the marginal likelihood of the other non-varying parameters by using a kalman filter on the varying parameters

The idea is (I think) would be to define the measurements to come from a base model m(p) with fixed parameters p (i.e. any pints model), plus a linear term with the varying parameters x, plus a normal noise term. That is, defined at time points k =1..N the measurements are:

z_k = m_k(p) + H_k x_k + v_k

that you would have a model for the varying parameters as

x_{k+1} = A_k * x_k + w_k

where x_k is the vector of varying parameters (i.e. states), A_k is a matrix defining how the states evolve over time, and w_k are samples from a multivariate normal distribution.

Given a set of fixed paramters p, everything else becomes linear you can use a kalman filter to calculate the likelihood https://en.wikipedia.org/wiki/Kalman_filter#Marginal_likelihood

The user would specify the base model m, the measurement matrix H_k, the transition matrix A_k, and the variances for v_k and w_k (or perhaps these could be unknowns).

Given that this would be able to be used with any pints model, it might be a useful to put in pints. Otherwise I'll keep it over in the electrochemistry repo.

martinjrobins avatar Aug 03 '18 16:08 martinjrobins