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 51961.33 total_deaths
#> 2 5-19 510073.92 total_deaths
#> 3 20-64 422477.81 total_deaths
#> 4 65+ 862653.63 total_deaths
#> 5 0-4 3593143.71 epidemic_size
#> 6 5-19 9441533.46 epidemic_size
#> 7 20-64 29139187.86 epidemic_size
#> 8 65+ 7946422.19 epidemic_size
#> 9 0-4 205991.79 total_hospitalisations
#> 10 5-19 2018726.43 total_hospitalisations
#> 11 20-64 1672220.20 total_hospitalisations
#> 12 65+ 3411639.38 total_hospitalisations
# get daily vaccinations
daily_vaccinations <- get_new_vaccinations(data)