| saved_states {pomp} | R Documentation |
Saved states
Description
Retrieve latent state trajectories from a particle filter calculation.
Usage
## S4 method for signature 'pfilterd_pomp'
saved_states(object, ..., format = c("list", "data.frame"))
## S4 method for signature 'pfilterList'
saved_states(object, ..., format = c("list", "data.frame"))
Arguments
object |
result of a filtering computation |
... |
ignored |
format |
character; format of the returned object (see below). |
Details
When one calls pfilter with save.states=TRUE, the latent state vector associated with each particle is saved.
This can be extracted by calling saved_states on the ‘pfilterd.pomp’ object.
These are the unweighted particles, saved after resampling.
Value
According to the format argument, the saved states are returned either as a list or a data frame.
If format="data.frame", then the returned data frame holds the state variables and (optionally) the unnormalized log weight of each particle at each observation time.
The .id variable distinguishes particles.
If format="list" and pfilter was called with save.states="unweighted" or save.states="TRUE", the returned list contains one element per observation time.
Each element consists of a matrix, with one row for each state variable and one column for each particle.
If pfilter was called with save.states="weighted", the list itself contains two lists:
the first holds the particles as above, the second holds the corresponding unnormalized log weights.
In particular, it has one element per observation time; each element is the vector of per-particle log weights.
See Also
More on sequential Monte Carlo methods:
bsmc2(),
cond_logLik(),
eff_sample_size(),
filter_mean(),
filter_traj(),
kalman,
mif2(),
pfilter(),
pmcmc(),
pred_mean(),
pred_var(),
wpfilter()
Other extraction methods:
coef(),
cond_logLik(),
covmat(),
eff_sample_size(),
filter_mean(),
filter_traj(),
forecast(),
logLik,
obs(),
pred_mean(),
pred_var(),
spy(),
states(),
summary(),
time(),
timezero(),
traces()