Extract filtered trajectory from running a particle filter
Source:R/trajectory.R
trajectory-SimInf_pfilter-method.Rd
Extract filtered trajectory from running a particle filter
Usage
# S4 method for class 'SimInf_pfilter'
trajectory(model, compartments, index, format = c("data.frame", "matrix"))
Arguments
- model
the
SimInf_pfilter
object to extract the result from.- compartments
specify the names of the compartments to extract data from. The compartments can be specified as a character vector e.g.
compartments = c('S', 'I', 'R')
, or as a formula e.g.compartments = ~S+I+R
(see ‘Examples’). Default (compartments=NULL
) is to extract the number of individuals in each compartment i.e. the data from all discrete state compartments in the model. In models that also have continuous state variables e.g. theSISe
model, they are also included.- index
indices specifying the subset of nodes to include when extracting data. Default (
index = NULL
) is to extract data from all nodes.- format
the default (
format = "data.frame"
) is to generate adata.frame
with one row per node and time-step with the number of individuals in each compartment. Usingformat = "matrix"
returns the result as a matrix, which is the internal format (see ‘Details’ intrajectory,SimInf_model-method
).