Takes in data from the R pomp package where the output is a data frame and puts it in SIR format for EpiCompare

# S3 method for pomp_df
fortify_aggregate(data, states = c("S", "I", "R"), package_source = NULL)

Arguments

data

Output from a pomp simulation where the output is a data frame, pomp::simulate(), and we have added the name pomp_df to the class names.

states

vector of state names

package_source

optional package name

Value

data frame with the following columns

t

the time

sim

simulation number (factor variable) (optional column)

Xk

where k = 0, ..., K

Details

The default variables that are retained are SIR, but can be modified with the states argument. If codestates = NULL, we will attempt to find all single letter names in POMP and output those.

Examples

out <- fortify_aggregate(pomp_df, package_source = "pomp", states = c("S", "I", "R")) head(out)
#> t sim X0 X1 X2 #> 1 0 1 950 50 0 #> 2 1 1 946 52 2 #> 3 2 1 944 54 2 #> 4 3 1 941 57 2 #> 5 4 1 937 60 3 #> 6 5 1 931 65 4
unique(rowSums(out[, 3:5]))
#> [1] 1000