Skip to contents

Functions to quickly summarise timeseries data from daedalus() to provide daily values for infections, hospitalisations, deaths, and vaccinations, while allowing grouping by different strata.

Usage

get_incidence(
  data,
  measures = c("infections", "hospitalisations", "deaths"),
  groups = NULL
)

get_epidemic_summary(
  data,
  measures = c("infections", "hospitalisations", "deaths"),
  groups = NULL
)

get_new_vaccinations(data, groups = NULL)

Arguments

data

Either a <data.frame> from a call to get_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() and get_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 a measures 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 by groups.

  • get_epidemic_summary() returns a data frame with the total number of the value specified in measure for each of the groups specified by groups.

  • get_daily_vaccinations() returns a data frame with columns for the number of new daily vaccination in each combination of groups if provided. Columns for the groups are added when groups 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)