The particle filter returns an estimate of the marginal log-likelihood \(L = p(y(t_{1:T})|\theta)\) as well as the set of filtered trajectories and their respective weights at the last observation time \(\omega(t_T)=p(y(t_T)|\theta)\).

particleFilter(fitmodel, theta, initState, data, nParticles, progress = FALSE)

Arguments

fitmodel

a fitmodel object

theta

named numeric vector. Values of the parameters. Names should match fitmodel$thetaNames.

initState

named numeric vector. Initial values of the state variables. Names should match fitmodel$stateNames.

data

data frame. Observation times and observed data. The time column must be named "time" and the observation column must be named "obs".

nParticles

number of particles

progress

if TRUE progression of the filter is displayed in the console.

Value

A list of 3 elements:

  • dPointObs the marginal log-likelihood of the theta.

  • traj a list of size nParticles with all filtered trajectories.

  • trajWeight a vector of size nParticles with the normalised weight of the filtered trajectories.

Note

An unbiased state sample \(x(t_{0:T}) ~ p(X(t_{0:T})|\theta,y(t_{0:T}))\) can be obtained by sampling the set of trajectories traj with probability trajWeight.

See also

plotSMC