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_daedalus()
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 35281.3 total_deaths
#> 2 5-19 257959.3 total_deaths
#> 3 20-65 245213.3 total_deaths
#> 4 65+ 288830.2 total_deaths
#> 5 0-4 2478956.1 epidemic_size
#> 6 5-19 4870458.3 epidemic_size
#> 7 20-65 17143379.3 epidemic_size
#> 8 65+ 2718611.4 epidemic_size
#> 9 0-4 141507.7 total_hospitalisations
#> 10 5-19 1036057.1 total_hospitalisations
#> 11 20-65 979956.8 total_hospitalisations
#> 12 65+ 1161234.8 total_hospitalisations
# get daily vaccinations
daily_vaccinations <- get_new_vaccinations(data)