Calculate daily incidences and summarise epidemic measures
Source:R/output_helpers.R
epi_output_helpers.Rd
Functions to quickly summarise timeseries data from
daedalus()
to provide daily values for infections, hospitalisations,
deaths, and vaccinations, while allowing grouping by different strata.
Arguments
- data
Either a
<data.frame>
from a call toget_data()
on a<daedalus_output>
object, or such an object directly.- measures
A character vector of one or more of the following, passed to
get_incidence()
andget_epidemic_summary()
:"infections"
,"hospitalisations"
or"deaths"
for the measure to return. Defaults to returning all three in long format.get_daily_vaccinations()
does not accept ameasures
argument and only provides the number of daily vaccinations.- groups
An optional character vector of grouping variables that correspond to model strata. Defaults to
NULL
which gives incidence across the whole population. Allowed groups correspond to modelled strata:"age_group"
,"vaccine_group"
, and"econ_sector"
.get_daily_vaccinations()
only accepts "age_group
" and"econ_sector"
.
Value
A <data.frame>
in long format, with one entry per
model timestep, measure, and group chosen.
get_incidence()
returns a data frame with the number of daily new infections, new hospitalisations, and/or new deaths in each of the groups specified bygroups
.get_epidemic_summary()
returns a data frame with the total number of the value specified inmeasure
for each of the groups specified bygroups
.get_daily_vaccinations()
returns a data frame with columns for the number of new daily vaccination in each combination ofgroups
if provided. Columns for thegroups
are added whengroups
are specified.
Examples
data <- daedalus("Canada", "sars_cov_1")
# new infections
new_infections <- get_incidence(data, "infections")
# epidemic summary
get_epidemic_summary(
data,
groups = "age_group"
)
#> age_group value measure
#> 1 0-4 71927.38 total_deaths
#> 2 5-19 701890.84 total_deaths
#> 3 20-64 584913.59 total_deaths
#> 4 65+ 1184421.70 total_deaths
#> 5 0-4 3582058.07 epidemic_size
#> 6 5-19 9353610.39 epidemic_size
#> 7 20-64 29046614.64 epidemic_size
#> 8 65+ 7854411.11 epidemic_size
#> 9 0-4 205399.18 total_hospitalisations
#> 10 5-19 2000298.89 total_hospitalisations
#> 11 20-64 1667109.25 total_hospitalisations
#> 12 65+ 3372595.91 total_hospitalisations
# get daily vaccinations
daily_vaccinations <- get_new_vaccinations(data)