| Title: | Model Health, Social, and Economic Costs of a Pandemic |
|---|---|
| Description: | Model the health, education, and economic costs of directly transmitted respiratory virus pandemics, under different scenarios of prior vaccine investment, policy interventions, and public behavioural change, using the 'DAEDALUS' integrated health-economics model adapted from Haw et al. (2022) <doi:10.1038/s43588-022-00233-0>. |
| Authors: | Pratik Gupte [aut, cre] (ORCID: <https://orcid.org/0000-0001-5294-7819>), Patrick Doohan [aut] (ORCID: <https://orcid.org/0000-0001-8076-1106>), Robert Johnson [aut] (ORCID: <https://orcid.org/0000-0002-7365-0042>), Pablo Perez-Guzman [aut] (ORCID: <https://orcid.org/0000-0002-5277-5196>), Rich FitzJohn [aut] (ORCID: <https://orcid.org/0000-0001-8888-3837>), Emma Russell [aut], David Mears [aut], Katharina Hauck [aut] (ORCID: <https://orcid.org/0000-0003-3138-4169>), Abdul Latif Jameel Institute for Disease and Emergency Analytics [fnd], Imperial College of Science, Technology and Medicine [cph, fnd] |
| Maintainer: | Pratik Gupte <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.7 |
| Built: | 2026-06-01 09:41:40 UTC |
| Source: | https://github.com/jameel-institute/daedalus |
Helper functions to prepare <daedalus_behaviour> class responses
corresponding to either old or new behavioural change mechanisms.
Inherits from <daedalus_response> to allow for more control in future over
when these mechanisms are active.
daedalus_old_behaviour(rate = 0.001, lower_limit = 0.2) daedalus_new_behaviour( hospital_capacity, behav_effectiveness = 0.5, baseline_optimism = 0.5, responsiveness = 1.5, k0 = 4.59, k1 = -9.19 ) is_daedalus_behaviour(x) ## S3 method for class 'daedalus_behaviour' print(x, ...)daedalus_old_behaviour(rate = 0.001, lower_limit = 0.2) daedalus_new_behaviour( hospital_capacity, behav_effectiveness = 0.5, baseline_optimism = 0.5, responsiveness = 1.5, k0 = 4.59, k1 = -9.19 ) is_daedalus_behaviour(x) ## S3 method for class 'daedalus_behaviour' print(x, ...)
rate |
The marginal rate of decrease in the scaling factor for each additional daily death in the 'old' behavioural model. |
lower_limit |
The lower limit of the scaling factor in the 'old' behavioural model; prevents scaling factor from reaching zero. |
hospital_capacity |
The emergency hospital capacity of a country, but
may also be a |
behav_effectiveness |
A single double value for the effectiveness of
adopting behavioural measures against the risk of infection. Expected to be
in the range |
baseline_optimism |
A single double value for the baseline optimism
about pandemic outcomes. Expected to be in the range |
responsiveness |
A single double value for the population responsiveness
to an epidemic signal. Must have a lower value of 0, but the upper bound is
open. See |
k0 |
A single, optional double value which is a scaling parameter for
the sigmoidal relationship between |
k1 |
A single, optional double value which is another scaling parameter
for the sigmoidal relationship between |
x |
A |
... |
Other arguments passed to |
Daedalus currently supports two behavioural models (and the option to have neither model active). These models simulate population-level changes towards adopting behaviours that help reduce the risk of infection, which might be expected during a major disease outbreak.
In both models, the transmission rate of the infection is
reduced for all transmissions by a scaling factor; the models differ in how
the scaling factor is calculated.
Note that a major issue with including this in a model run (any value
other than "off") is that it leads to substantially lower response costs,
and generally better health outcomes (lives lost), without accounting for
any attendant economic or social costs. As such, please treat the
behavioural models as experimental.
This model existed prior to daedalus v0.2.25 and is referred to as the
"old" behavioural model.
The scaling factor for in this model is
where is the marginal rate of reduction for each additional
death per day (), and is the lower limit of the scaling
factor to prevent the FOI going to zero.
This model is referred to as the "new" behavioural model, and the scaling
factor for is given by
where is the proportion of the population taking protective
behaviour and is the effectiveness of the behaviour, both in the
range . When either is zero, is not scaled down.
is computed during the model run, and is given by
where are scaling parameters.
have constant values that cannot be changed by the user, and
these have been chosen to produce a sigmoidal relationship between
and .
a constant user-supplied parameter that should be interpreted as
population responsiveness to a signal of epidemic severity
, which is the relative burden on hospital capacity
(: hospital demand at time , and
: emergency hospital capacity).
is a constant user-supplied parameter that captures the baseline
population optimism about the outbreak.
An object of class <daedalus_behaviour> which inherits from
<daedalus_response>. This is primarily a list holding behavioural
parameters.
Helper functions to create and work with S3 class
<daedalus_country> objects for use with daedalus().
These objects store country parameters for reuse and have methods for easy
parameter access and editing, as well as processing raw country
characteristics for the DAEDALUS model.
daedalus_country(country, contact_matrix = NULL, group_working_age = NULL) is_daedalus_country(x) ## S3 method for class 'daedalus_country' print(x, ...)daedalus_country(country, contact_matrix = NULL, group_working_age = NULL) is_daedalus_country(x) ## S3 method for class 'daedalus_country' print(x, ...)
country |
A string giving the country or territory name, or ISO2 or ISO3 code; must be from among daedalus.data::country_codes_iso2c or daedalus.data::country_codes_iso3c or daedalus.data::country_names. |
contact_matrix |
An optional named list of numeric matrices,
representing age-specific contact matrices in different contexts or settings.
Defaults to |
group_working_age |
An optional value for the age-group that is
considered to be the working-age group. Defaults to |
x |
An object of the |
... |
Other parameters passed to |
daedalus_country() returns an object of the S3 class <daedalus_country>
is_daedalus_country() returns a logical for whether an object is a
<daedalus_country>.
print.daedalus_country() invisibly returns the <daedalus_country>
object x. Called for printing side-effects.
x <- daedalus_country("Canada") x # check whether `x` is a <country> object is_daedalus_country(x) # using assignment operators; must be assigned as a list x$contact_matrix <- list(home = matrix(99, 4, 4), school = matrix(1, 4, 4)) xx <- daedalus_country("Canada") x # check whether `x` is a <country> object is_daedalus_country(x) # using assignment operators; must be assigned as a list x$contact_matrix <- list(home = matrix(99, 4, 4), school = matrix(1, 4, 4)) x
<daedalus_output> objectsCreate and work with <daedalus_output> objects
Print <daedalus_output> class objects
as_daedalus_output(x) validate_daedalus_output(x) is_daedalus_output(x) ## S3 method for class 'daedalus_output' print(x, ...)as_daedalus_output(x) validate_daedalus_output(x) is_daedalus_output(x) ## S3 method for class 'daedalus_output' print(x, ...)
x |
An object of the |
... |
Not used; added for compatibility with the generic. |
An object of the <daedalus_output> class. Holds the raw ODE solution and
ODE events logs in dust2 forma), as well as country, infection,
vaccination, and behaviour classes representing input arguments to
daedalus().
Invisibly returns x; called primarily for its side effects of
erroring when the object does not satisfy the <daedalus_output> class
requirements.
A logical for whether x is of the <daedalus_output> class.
None; called for its printing side effects.
Helper functions to create and work with S3 class
<daedalus_infection> objects for use with daedalus().
These objects store infection parameters for reuse and have methods for easy
parameter access and editing, as well as processing raw infection
characteristics for the DAEDALUS model.
daedalus_infection(name, ...) is_daedalus_infection(x) ## S3 method for class 'daedalus_infection' print(x, ...)daedalus_infection(name, ...) is_daedalus_infection(x) ## S3 method for class 'daedalus_infection' print(x, ...)
name |
An epidemic name from among daedalus.data::epidemic_names.
Selecting an epidemic automatically pulls in infection parameters
associated with the epidemic; these are stored as packaged data in
|
... |
Other parameters passed to |
x |
An object of the |
Epidemics for which data are available are given below (pathogen in
parentheses). The string indicates the name that must be passed to the name
argument.
"sars_cov_1": SARS 2004 (SARS-CoV-1),
"influenza_2009": influenza 2009 (influenza A H1N1),
"influenza_1957": influenza 1957 (influenza A H2N2),
"influenza_1918": influenza 1918 (influenza A H1N1),
"sars_cov_2_pre_alpha": Covid-19 wild type (SARS-Cov-2 wild type),
"sars_cov_2_omicron": Covid-19 Omicron (SARS-CoV-2 omicron),
"sars_cov_2_pre_delta": (SARS-CoV-2 delta).
All infections have the following parameters, which take default values
stored in the package under daedalus.data::infection_data. Users can pass
custom values for these parameters as arguments via ....
r0: A single numeric value for the basic reproduction value of the
infection .
sigma: A single numeric value > 0.0 for the rate of transition from the
exposed compartment to one of two infectious compartments.
p_sigma: A single numeric value in the range for the
proportion of infectious individuals who are also symptomatic. Asymptomatic
individuals can have a different contribution to the force of infection from
symptomatic individuals.
epsilon: A single numeric value for the relative contribution of
asymptomatic infectious individuals to the force of infection (compared to
symptomatic individuals).
gamma_Is: A single numeric value for the recovery rate of infectious
individuals who are not hospitalised.
gamma_Ia: A single numeric value for the recovery rate from asymptomatic
infection.
ifr: A numeric vector of length N_AGE_GROUPS (4) for the
age-specific infection fatality risk.
eta: A numeric vector of length N_AGE_GROUPS (4) for the age-specific
hospitalisation rate for individuals who are infectious and symptomatic.
hfr: A numeric vector of length N_AGE_GROUPS (4) for the age-specific
probability of death conditional on hospitalisation.
gamma_H_recovery: A single numeric value for the recovery rate of
hospitalised individuals.
gamma_H_death: A single numeric value for the death rate of
hospitalised individuals.
rho: A single numeric value for the rate at which infection-derived
immunity wanes, returning individuals in the 'recovered' compartment to the
'susceptible' compartment.
daedalus_infection() returns an object of the S3 class
<daedalus_infection>.
is_daedalus_infection() returns a logical for whether an object is a
<daedalus_infection>.
print.daedalus_infection() invisibly returns the <daedalus_infection>
object x. Called for printing side-effects.
# make a <daedalus_infection> object with default parameter values daedalus_infection("sars_cov_1") # modify infection parameters R0 and immunity waning rate daedalus_infection("influenza_1918", r0 = 2.5, rho = 0.01)# make a <daedalus_infection> object with default parameter values daedalus_infection("sars_cov_1") # modify infection parameters R0 and immunity waning rate daedalus_infection("influenza_1918", r0 = 2.5, rho = 0.01)
Helper functions to create and work with S3 class
<daedalus_npi> objects for use with daedalus().
These objects store NPI parameters for reuse and have methods for
easy parameter access and editing, as well as processing raw NPI
characteristics for the DAEDALUS model.
Most NPIs must be initialised with an associated country and infection;
these are used to determine flag positions as well as the state-values
(hospital capacity) and incidence-prevalence ratio (IPR) at which the NPI
starts and ends reactively.
daedalus_timed_npi() is a helper function to create a <daedalus_npi> that
is only trigged by time, and is not responsive to state variables.
Primarily intended for use in real time modelling.
daedalus_npi( name, country, infection, openness = NULL, start_time = 30, end_time = NULL, max_duration = 365 ) is_daedalus_npi(x) ## S3 method for class 'daedalus_npi' print(x, ...) daedalus_timed_npi(start_time, end_time, openness, country)daedalus_npi( name, country, infection, openness = NULL, start_time = 30, end_time = NULL, max_duration = 365 ) is_daedalus_npi(x) ## S3 method for class 'daedalus_npi' print(x, ...) daedalus_timed_npi(start_time, end_time, openness, country)
name |
An NPI strategy name from among
daedalus.data::closure_strategy_names, or Pass |
country |
A country or territory object of class |
infection |
An infection parameter object of the class
|
openness |
For For Expected to have a minimum size of |
start_time |
For For |
end_time |
For For |
max_duration |
The maximum number of days that an NPI response is active
whether started by passing the |
x |
An object to be tested or printed as a |
... |
For |
Note that NPIs created using daedalus_npi() are reactive to the model state
(i.e., the epidemic state), and can trigger multiple times when state
conditions are met.
daedalus_npi(): A <daedalus_npi> class object that specifies an NPI that
may be responsive to both model state and time.
daedalus_timed_npi(): A <daedalus_npi> class object which specifies
time-limited interventions only.
# for a school closure strategy daedalus_npi("school_closures", "GBR", "sars_cov_1") # set custom openness daedalus_npi( NA, "GBR", "sars_cov_1", openness = cbind(rep(1, 49), rep(0.1, 49)) ) # time-limited NPI with multiple phases phase_1 <- cbind( rep(1, 49), rep(0.5, 49) ) phase_2 <- cbind( rep(1, 49), rep(0.3, 49) ) phase_3 <- cbind( rep(1, 49), rep(0.8, 49) ) daedalus_timed_npi( start_time = c(10, 20, 30), end_time = c(15, 25, 40), openness = list( phase_1, phase_2, phase_3 ), country = "GBR" )# for a school closure strategy daedalus_npi("school_closures", "GBR", "sars_cov_1") # set custom openness daedalus_npi( NA, "GBR", "sars_cov_1", openness = cbind(rep(1, 49), rep(0.1, 49)) ) # time-limited NPI with multiple phases phase_1 <- cbind( rep(1, 49), rep(0.5, 49) ) phase_2 <- cbind( rep(1, 49), rep(0.3, 49) ) phase_3 <- cbind( rep(1, 49), rep(0.8, 49) ) daedalus_timed_npi( start_time = c(10, 20, 30), end_time = c(15, 25, 40), openness = list( phase_1, phase_2, phase_3 ), country = "GBR" )
Helper functions to create and work with S3 class
<daedalus_vaccination> objects for use with daedalus().
These objects store vaccination parameters for reuse and have methods for
easy parameter access and editing, as well as processing raw vaccination
characteristics for the DAEDALUS model.
daedalus_vaccination( name, country, start_time = NULL, rate = NULL, uptake_limit = NULL, efficacy = 50, waning_period = 180 ) is_daedalus_vaccination(x) ## S3 method for class 'daedalus_vaccination' print(x, ...)daedalus_vaccination( name, country, start_time = NULL, rate = NULL, uptake_limit = NULL, efficacy = 50, waning_period = 180 ) is_daedalus_vaccination(x) ## S3 method for class 'daedalus_vaccination' print(x, ...)
name |
A vaccination investment scenario name as a string.
Passing a name from among daedalus.data::vaccination_scenario_names leads
to any optional parameters (see below) being drawn from pre-canned scenarios.
These are stored as packaged data in
Passing a name that is not among pre-canned scenarios causes all following parameters to become compulsory and non-optional. |
country |
A |
start_time |
The number of days after the start of the epidemic that
vaccination begins. Must be a single number. Defaults to |
rate |
A single number for the percentage of the total population that
can be vaccinated each day. This is converted into a proportion automatically
within |
uptake_limit |
A single number giving the upper limit for the
percentage of the population that can be vaccinated. When this limit is
reached, vaccination ends. Passed to the |
efficacy |
A single number in the range |
waning_period |
A single number representing the number of days over which the average individual wanes out of the vaccinated stratum to the unvaccinated stratum. Only individuals in the susceptible and recovered compartments can wane out of being vaccinated. Defaults to 180 days. |
x |
An object to be tested or printed as a |
... |
For |
Note that vaccination once ended by reaching the uptake_limit does not
restart once individuals wane out of the vaccinated compartment.
# for no advance vaccine investment in the UK daedalus_vaccination("none", "GBR") # modifying parameters for pre-defined strategies during initialisation # set daily vaccination rate to 1.5% of population daedalus_vaccination("low", "GBR", rate = 1.5) # a fully customised strategy daedalus_vaccination( "custom", "GBR", start_time = 100, rate = 1.5, uptake_limit = 70 )# for no advance vaccine investment in the UK daedalus_vaccination("none", "GBR") # modifying parameters for pre-defined strategies during initialisation # set daily vaccination rate to 1.5% of population daedalus_vaccination("low", "GBR", rate = 1.5) # a fully customised strategy daedalus_vaccination( "custom", "GBR", start_time = 100, rate = 1.5, uptake_limit = 70 )
Run the DAEDALUS model from R. This is a work in progress.
daedalus( country, infection, response_strategy = NULL, vaccine_investment = NULL, behaviour = NULL, response_time = 30, initial_state_manual = NULL, time_end = 600, ... )daedalus( country, infection, response_strategy = NULL, vaccine_investment = NULL, behaviour = NULL, response_time = 30, initial_state_manual = NULL, time_end = 600, ... )
country |
A country or territory object of class |
infection |
An infection parameter object of the class
|
response_strategy |
A string for the name of response strategy followed,
a numeric of length 45 (number of economic sectors), a matrix with dimensions
49 x N where N is the number of contacts settings, or a |
vaccine_investment |
Either a single string or a
|
behaviour |
An optional object of class |
response_time |
A single numeric value for the time in days
at which the selected response is activated. This is ignored if the response
has already been activated by the hospitalisation threshold being reached.
Defaults to 30 days. Responses have a default maximum duration of 365 days.
This can be changed by passing a |
initial_state_manual |
An optional named list with the names
|
time_end |
An integer-like value for the number of timesteps at which to return data. This is treated as the number of days with data returned for each day. Defaults to 300 days. |
... |
Optional arguments that are passed to |
Users can pass the following initial state parameters to
initial_state_manual:
p_infectious: A single numeric value in the range giving
the proportion of individuals in each age group and economic sector that are
to be initialised as infectious. Defaults to 1e-6, or one in every one
million as infectious.
p_asymptomatic: A single numeric value in the range for
the proportion of initially infectious individuals who are considered to be
asymptomatic. Defaults to 0.0.
p_immune: Either a single number or a vector of 4 elements (the number
of age groups) in the range for the proportion of the
population (or each age group) that is considered to have pre-existing
immunity. This is a stop-gap implementation that assumes one of two cases:
(1) if no vaccination is intended in the model and vaccine_investment is
NULL, the susceptibility of individuals pre-existing immunity is 50%; or
(2) if a vaccination strategy is specified, the pre-existing immunity is
assumed to be from a prior rollout, and the susceptibility is determined by
the chosen vaccination strategy (as 1 - efficacy).
A <daedalus_output> object if infection is a string or a single
<daedalus_infection> object.
# country and infection specified by strings using default characteristics output <- daedalus( "Canada", "influenza_1918" ) # print output output # country passed as <daedalus_country> with a new 'total' contact matrix conmat_new <- get_data(daedalus_country("Canada"), "contact_matrix") country_x <- daedalus_country( "Canada", contact_matrix = list(total = conmat_new * 2.0) # simulate new data ) output <- daedalus(country_x, "influenza_1918") # with some infection parameters over-ridden by the user output <- daedalus( "United Kingdom", daedalus_infection("influenza_1918", r0 = 1.3) ) # with default initial conditions over-ridden by the user output <- daedalus( "United Kingdom", "influenza_1918", initial_state_manual = list(p_infectious = 1e-3) ) # including behavioural modification output <- daedalus( "Canada", "influenza_1918", behaviour = daedalus_old_behaviour(), time_end = 100 )# country and infection specified by strings using default characteristics output <- daedalus( "Canada", "influenza_1918" ) # print output output # country passed as <daedalus_country> with a new 'total' contact matrix conmat_new <- get_data(daedalus_country("Canada"), "contact_matrix") country_x <- daedalus_country( "Canada", contact_matrix = list(total = conmat_new * 2.0) # simulate new data ) output <- daedalus(country_x, "influenza_1918") # with some infection parameters over-ridden by the user output <- daedalus( "United Kingdom", daedalus_infection("influenza_1918", r0 = 1.3) ) # with default initial conditions over-ridden by the user output <- daedalus( "United Kingdom", "influenza_1918", initial_state_manual = list(p_infectious = 1e-3) ) # including behavioural modification output <- daedalus( "Canada", "influenza_1918", behaviour = daedalus_old_behaviour(), time_end = 100 )
Calculate the costs of an epidemic and any mitigation measures, either from a Daedalus model run, or from a timeseries of epidemic data and relevant demographic and economic parameters.
## S3 method for class 'daedalus_output' get_costs( x, summarise_as = c("none", "total", "domain"), productivity_loss_infection = 1, ... ) ## S3 method for class 'data.frame' get_costs( x, comp_non_working, comp_infected, comp_dead, workforce, daily_gva, productivity_loss_infection, vsl_by_age, life_expectancy, value_school_year, n_students, edu_effectiveness_remote, npi_data = NULL, summarise_as = c("none", "total", "domain"), ... ) get_costs(x, ...)## S3 method for class 'daedalus_output' get_costs( x, summarise_as = c("none", "total", "domain"), productivity_loss_infection = 1, ... ) ## S3 method for class 'data.frame' get_costs( x, comp_non_working, comp_infected, comp_dead, workforce, daily_gva, productivity_loss_infection, vsl_by_age, life_expectancy, value_school_year, n_students, edu_effectiveness_remote, npi_data = NULL, summarise_as = c("none", "total", "domain"), ... ) get_costs(x, ...)
x |
A If |
summarise_as |
A string from among "none", "total", or "domain", for how the costs should be returned. Select "none", the default, for the raw costs along with overall and domain-specific totals; "total" for the overall cost, and "domain" for the total costs per domain; the domains are 'economic', 'education', and 'life years'. |
productivity_loss_infection |
A single number in the range
|
... |
< |
comp_non_working |
A character vector giving the names of compartments in which individuals are assumed to have a reduced ability to work. This may (and should) include compartments where individuals are infected and symptomatic, as well as hospitalised or dead. |
comp_infected |
A character vector giving the name of compartments in which individuals are assumed to be infected with reduced ability to work. This should not include compartments where individuals are assumed to have no ability to work (hospitalised or dead). |
comp_dead |
A string giving the name of the compartment holding the count of deaths. Note that only a single deaths compartment is supported, so models with multiple death states should pass the final state. Used to calculate the value of lives lost. |
workforce |
A numeric vector of the number of workers in each economic
sector of the population. Must be absolute numbers (i.e., not scaled to
thousands or millions). Must have the same length as |
daily_gva |
A numeric vector of the daily gross-value added (GVA) in million dollars, by each economic sector of the population (or territory or state) in which the epidemic occurs. |
vsl_by_age |
A numeric vector of the value of a statistical life (VSL)
for each age age group in |
life_expectancy |
A numeric vector of the life-expectancy per age group.
Expected to be the same length as |
value_school_year |
A single number giving the value of a school year.
Users can use the helper function |
n_students |
A single number for the number of students in the population, whose education is expected to be impacted by the epidemic. |
edu_effectiveness_remote |
A single number for the effectiveness of
remote education, in the range |
npi_data |
A list with numeric elements that mirrors the elements of a
|
When a <data.frame> x is passed, it must have at least one row, at least
some non-missing values, and:
Columns "time", "age_group", "compartment", "econ_sector", and
"value", giving the model time (numeric), age group identifier (character),
epidemiological compartment identifier (character), economic sector
identifier (character), and the value of the number of individuals in each
age, epi-compartment, and economic group at each time (numeric). Numeric
values must be non-negative , non-missing, and finite.
Compartments in comp_infected, comp_non_working, and comp_dead must
be found in x$compartment.
All compartments of comp_infected and comp_dead must be in
comp_non_working.
The total cost in million dollars is returned as total_cost. This is
comprised of the following costs.
A three element list of economic_cost_total, the total costs from pandemic
impacts on economic sectors, including both costs of lost gross value added
(GVA) due to pandemic-control restrictions or closures
(economic_cost_closures), and pandemic-related absences due to illness and
death (economic_cost_absences).
A three element list of education_cost_total, the total costs from pandemic
impacts on education due to pandemic-control restrictions or closures
(education_cost_closures), and pandemic-related absences due to illness and
death (education_cost_absences).
A four-element vector (for the number of age groups) giving the value of life-years lost per age group. This is calculated as the life-expectancy of each age group times the value of a statistical life, with all years assumed to have the same value.
A four-element vector (for the number of age groups) giving the value of life-years lost per age group. This is calculated as the life-expectancy of each age group times the number of deaths in that age group. No quality adjustment is applied.
A list of different cost values, including the total cost. See Details for more information.
# for <daedalus_output> objects from `daedalus()` o <- daedalus("CAN", "sars_cov_1", time_end = 100) get_costs(o, "domain") # for a data.frame of epi compartment timeseries, as from any epi model output <- daedalus("Canada", "influenza_1918", time_end = 100) data <- get_data(output) comp_non_working <- c( "infect_symp", "hospitalised_recov", "hospitalised_death", "dead" ) comp_infected <- "infect_symp" comp_dead <- "dead" daily_gva <- output$country$gva workforce <- output$country$workers vsl_by_age <- output$country$vsl life_expectancy <- output$country$life_expectancy value_school_year <- 1e6 # 1 million dollars n_students <- output$country$demography[3L] edu_effectiveness_remote <- 0.33 productivity_loss_infection <- 1.0 get_costs( data, comp_non_working, comp_infected, comp_dead, daily_gva, workforce, vsl_by_age, life_expectancy, value_school_year, n_students, productivity_loss_infection = productivity_loss_infection, edu_effectiveness_remote = edu_effectiveness_remote, summarise_as = "domain" )# for <daedalus_output> objects from `daedalus()` o <- daedalus("CAN", "sars_cov_1", time_end = 100) get_costs(o, "domain") # for a data.frame of epi compartment timeseries, as from any epi model output <- daedalus("Canada", "influenza_1918", time_end = 100) data <- get_data(output) comp_non_working <- c( "infect_symp", "hospitalised_recov", "hospitalised_death", "dead" ) comp_infected <- "infect_symp" comp_dead <- "dead" daily_gva <- output$country$gva workforce <- output$country$workers vsl_by_age <- output$country$vsl life_expectancy <- output$country$life_expectancy value_school_year <- 1e6 # 1 million dollars n_students <- output$country$demography[3L] edu_effectiveness_remote <- 0.33 productivity_loss_infection <- 1.0 get_costs( data, comp_non_working, comp_infected, comp_dead, daily_gva, workforce, vsl_by_age, life_expectancy, value_school_year, n_students, productivity_loss_infection = productivity_loss_infection, edu_effectiveness_remote = edu_effectiveness_remote, summarise_as = "domain" )
Run daedalus() for multiple parameter sets, with the intended use case of
running the model under uncertainty in infection parameters.
daedalus_multi_infection( country, infection, response_strategy = NULL, vaccine_investment = NULL, behaviour = NULL, response_time = 30, initial_state_manual = NULL, time_end = 600, ... )daedalus_multi_infection( country, infection, response_strategy = NULL, vaccine_investment = NULL, behaviour = NULL, response_time = 30, initial_state_manual = NULL, time_end = 600, ... )
country |
A country or territory object of class |
infection |
A list of |
response_strategy |
A string for the name of response strategy followed,
a numeric of length 45 (number of economic sectors), a matrix with dimensions
49 x N where N is the number of contacts settings, or a |
vaccine_investment |
Either a single string or a
|
behaviour |
An optional object of class |
response_time |
A single numeric value for the time in days
at which the selected response is activated. This is ignored if the response
has already been activated by the hospitalisation threshold being reached.
Defaults to 30 days. Responses have a default maximum duration of 365 days.
This can be changed by passing a |
initial_state_manual |
An optional named list with the names
|
time_end |
An integer-like value for the number of timesteps at which to return data. This is treated as the number of days with data returned for each day. Defaults to 300 days. |
... |
Optional arguments that are passed to |
A list of <daedalus_output> objects of the same length as
infection.
Economic constants used in DAEDALUS
EDU_EFFECTIVENESS_REMOTE EDU_ANNUAL_ROR WORK_EXPECTED_YEARS EARNINGS_LOSS_DISCOUNTEDU_EFFECTIVENESS_REMOTE EDU_ANNUAL_ROR WORK_EXPECTED_YEARS EARNINGS_LOSS_DISCOUNT
An object of class numeric of length 1.
An object of class numeric of length 1.
An object of class numeric of length 1.
An object of class numeric of length 1.
The Daedalus model uses these constants for economic value calculations:
edu_effectiveness_remote: The effectiveness of remote education.
edu_annual_ror: The rate of return on a year of education.
work_expected_years: The expected number of years of work for school-age
children.
earnings_loss_discount: The discounting rate used in the calculation of
lost earnings.
Names and indices for the epidemiological compartments used in
DAEDALUS, for reuse in model code. The duplication is for ease of extracting
indices from a named list, and of extracting names without having to call
names().
COMPARTMENTS idx_COMPARTMENTS N_EPI_COMPARTMENTS i_EPI_COMPARTMENTS N_MODEL_COMPARTMENTS N_INFECTION_SUBSYSTEMCOMPARTMENTS idx_COMPARTMENTS N_EPI_COMPARTMENTS i_EPI_COMPARTMENTS N_MODEL_COMPARTMENTS N_INFECTION_SUBSYSTEM
An object of class character of length 10.
An object of class list of length 10.
An object of class integer of length 1.
An object of class integer of length 8.
An object of class integer of length 1.
An object of class integer of length 1.
DAEDALUS has 8 epidemiological compartments: susceptible, exposed, infectious and symptomatic ("infect_symp"), infectious and asymptomatic ("infect_asymp") , hospitalised leading to recovery ("hospitalised_recov"), hospitalised leading to death ("hospitalised_death"), recovered, and dead.
There are 2 additional compartments that track the number of new infections and new hospitalisations.
COMPARTMENTS returns a character vector of the epidemiological
compartment names. idx_COMPARTMENTS returns a list with the compartment
index.
All other constants return integer values.
Functions to quickly summarise timeseries data from
daedalus() to provide daily values for infections, hospitalisations,
deaths, and vaccinations, while allowing grouping by different strata.
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)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)
data |
Either a |
measures |
A character vector of one or more of the following, passed to
|
groups |
An optional character vector of grouping variables that
correspond to model strata. Defaults to
|
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.
data <- daedalus("Canada", "sars_cov_1") # new infections new_infections <- get_incidence(data, "infections") # epidemic summary get_epidemic_summary( data, groups = "age_group" ) # get daily vaccinations daily_vaccinations <- get_new_vaccinations(data)data <- daedalus("Canada", "sars_cov_1") # new infections new_infections <- get_incidence(data, "infections") # epidemic summary get_epidemic_summary( data, groups = "age_group" ) # get daily vaccinations daily_vaccinations <- get_new_vaccinations(data)
Generic and methods for S3 classes for safely getting class parameters.
## S3 method for class 'daedalus_country' get_data(x, to_get, setting = c("default", "all"), ...) ## S3 method for class 'daedalus_infection' get_data(x, to_get, ...) ## S3 method for class 'daedalus_npi' get_data(x, to_get, ...) ## S3 method for class 'daedalus_output' get_data(x, to_get = NULL, ...) ## S3 method for class 'daedalus_vaccination' get_data(x, to_get, ...) get_data(x, ...)## S3 method for class 'daedalus_country' get_data(x, to_get, setting = c("default", "all"), ...) ## S3 method for class 'daedalus_infection' get_data(x, to_get, ...) ## S3 method for class 'daedalus_npi' get_data(x, to_get, ...) ## S3 method for class 'daedalus_output' get_data(x, to_get = NULL, ...) ## S3 method for class 'daedalus_vaccination' get_data(x, to_get, ...) get_data(x, ...)
x |
An S3 class object from the daedalus package of the
|
to_get |
A string giving the name of the element of |
setting |
Optional string for a contact setting. Defaults to the first provided contact matrix if multiple are present. |
... |
< |
Returns a member of x, with the class preserved
(e.g. numeric vector for a country "demography").
For <daedalus_output> objects, returns the model timeseries data when no
element is specified.
# simple example of getting data country_A <- daedalus_country("United Kingdom") get_data(country_A, "demography") get_data(country_A, "contact_matrix") disease_x <- daedalus_infection("sars_cov_1", r0 = 1.9) get_data(disease_x, "r0") # get model data output <- daedalus("Canada", "influenza_1918") head( get_data(output) )# simple example of getting data country_A <- daedalus_country("United Kingdom") get_data(country_A, "demography") get_data(country_A, "contact_matrix") disease_x <- daedalus_infection("sars_cov_1", r0 = 1.9) get_data(disease_x, "r0") # get model data output <- daedalus("Canada", "influenza_1918") head( get_data(output) )
A helper function that post-processes a <daedalus_output> object to
calculate the costs to a national government (fiscal costs) of responding to
a pandemic. Includes costs of economic support, vaccinations given, and NPIs
administered or implemented.
get_fiscal_costs( x, support_level = 0.2, price_vax = 1, price_npi = 1, uptake_npi = 1, interest_rate = 4, tax_rate = 35, spending_rate = 45, starting_debt = 0, productivity_loss_infection = 1 )get_fiscal_costs( x, support_level = 0.2, price_vax = 1, price_npi = 1, uptake_npi = 1, interest_rate = 4, tax_rate = 35, spending_rate = 45, starting_debt = 0, productivity_loss_infection = 1 )
x |
A If |
support_level |
The proportion of pandemic-related economic losses that a government compensates, as a proportion. |
price_vax |
The per-dose price of vaccination. |
price_npi |
The per-day and per-person price of implementing any pandemic response. May include costs such as testing or masks. |
uptake_npi |
The extent to which NPIs are taken up by the population; essentially a number that modifies (reduces) the total cost of implementing an NPI. |
interest_rate |
The annual interest rate on government borrowing for pandemic response. |
tax_rate |
The annual mean tax rate on economic output; used to calculate government revenue. |
spending_rate |
The annual mean rate of public spending as a percentage of GDP. |
starting_debt |
The value of national starting debt. Currently assumed to be zero while country-specific data are collected. |
productivity_loss_infection |
A single number in the range
|
Default argument values are intended to be representative. This
function is intended to be called after daedalus() and parameters
required to compute fiscal costs may need to be bundled along with model
outputs.
Note that all rates (interest rate, spending rate, and tax rate) are given as
annual percentages. Only the interest rate is converted to an daily value
from an annual one for use in compounding.
Spending is calculated as:
where is the time-specific cost of vaccination, and is calculated
as the cost of new vaccinations in each timestep:
.
is the time-specific cost of implementing pandemic response,
and is calculated as , where
is the remaining number of individuals in the population,
and is the proportion taking up any protection offered by the
response.
We assume that the government borrows to spend on pandemic mitigation measures outlined above such that the total cost to the public is then
where is the daily rate of interest to be paid on the borrowed
amount.
The interest rate is modelled as being constant over time. Users pass the
annual rate of interest as a percentage, and this is converted to a daily
rate using the internal function annual_rate_daily() as
.
The total public debt at the end of the pandemic is then the sum of
:
total public spending on the pandemic ,
existing day-to-day public spending which is assumed to be a
fraction of daily GDP ,
existing debt owed due to past daily spending (including on pandemic mitigation), and interest to be paid on the debt,
less the revenues collected from taxation, ,
where is the mean rate of taxation.
The daily GVA is the pre-pandemic GVA scaled by the available labour supply during the pandemic, taking into account labour restrictions due to illness-related absences and deaths, and response-related restrictions.
GDP is calculated as the sum of sector-specific daily GVA, and existing debt is currently assumed to be zero and is not included in the equation.
A two-element list giving:
A list of fiscal_costs with elements giving the fiscal costs
and a breakdown of these costs, as well as interest;
A list of public_debt of the public debt , which is
the net of baseline public spending, pandemic response costs, and
pandemic-impacted revenue.
# get fiscal costs for UK with SARS-CoV-2 # and both closures and vaccinations o <- daedalus( "GBR", "sars_cov_2_pre_alpha", "economic_closures", "high", time_end = 100 ) fc <- get_fiscal_costs(o) # also works when no closures are applied o <- daedalus( "CAN", "influenza_2009", time_end = 30 ) # Compare public debt added estimates with other estimates from Covid-19: # https://www.ctf.ca/EN/EN/Newsletters/Perspectives/2020/3/200302.aspx get_fiscal_costs(o)# get fiscal costs for UK with SARS-CoV-2 # and both closures and vaccinations o <- daedalus( "GBR", "sars_cov_2_pre_alpha", "economic_closures", "high", time_end = 100 ) fc <- get_fiscal_costs(o) # also works when no closures are applied o <- daedalus( "CAN", "influenza_2009", time_end = 30 ) # Compare public debt added estimates with other estimates from Covid-19: # https://www.ctf.ca/EN/EN/Newsletters/Perspectives/2020/3/200302.aspx get_fiscal_costs(o)
Get life-years lost by demographic group.
get_life_years_lost(output, groups = c("none", "age_group"))get_life_years_lost(output, groups = c("none", "age_group"))
output |
A |
groups |
Whether to get the life-years lost by age group. Selecting
|
A <data.frame> with the number of life-years lost, optionally per
age-group.
Frequently used values for the DAEDALUS model related to the model population and structure. See also epi_constants for constants specific to the epidemiological model.
N_AGE_GROUPS i_AGE_GROUPS N_VACCINE_STRATA N_VACCINE_DATA_GROUPS AGE_GROUPS i_WORKING_AGE i_SCHOOL_AGE N_ECON_SECTORS i_ECON_SECTORS i_EDUCATION_SECTOR N_ECON_STRATA i_NOT_WORKING DIM_AGE_GROUPS DIM_EPI_COMPARTMENTS DIM_ECON_SECTORS DIM_VACCINE_STRATA i_UNVACCINATED_STRATUM i_VACCINATED_STRATUM i_NEW_VAX_STRATUM VACCINE_GROUPS N_OUTPUT_COLS N_FLAGS FLAG_NAMES MIN_DATA_COL_NAMESN_AGE_GROUPS i_AGE_GROUPS N_VACCINE_STRATA N_VACCINE_DATA_GROUPS AGE_GROUPS i_WORKING_AGE i_SCHOOL_AGE N_ECON_SECTORS i_ECON_SECTORS i_EDUCATION_SECTOR N_ECON_STRATA i_NOT_WORKING DIM_AGE_GROUPS DIM_EPI_COMPARTMENTS DIM_ECON_SECTORS DIM_VACCINE_STRATA i_UNVACCINATED_STRATUM i_VACCINATED_STRATUM i_NEW_VAX_STRATUM VACCINE_GROUPS N_OUTPUT_COLS N_FLAGS FLAG_NAMES MIN_DATA_COL_NAMES
An object of class integer of length 1.
An object of class integer of length 4.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class character of length 4.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 45.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class character of length 3.
An object of class integer of length 1.
An object of class integer of length 1.
An object of class character of length 9.
An object of class character of length 5.
The DAEDALUS model requires the following values to be fixed.
Number of age groups: 4
Number of vaccination strata: 2
Age group bins: 0-4 years, 5-19 years, 20-65 years (working age), 65+ years
Index of the working-age age groups: 3; see AGE_GROUPS
Number of economic sectors: 45
Index of individuals not working as a layer in the 3D state tensor: 1
Number of economic strata: 46; note that this is always one more than the number of economic sectors, with the additional stratum for those not in work which includes all individuals not of working age, and a proportion of working age individuals.
Array dimension of age groups: 1
Array dimension of epidemiological compartments: 2
Array dimension of economic sectors: 3
Array dimension of vaccination strata: 4
Indices and numbers of key groups.
Number of state variables that are flags, switches, or indicators.
Values for the model constants.
Generic and methods for S3 classes for safely setting class
parameters. Only parameters considered safe to change – mostly contact data
in the <country>, but all parameters in <infection> – can be changed in
this way.
## S3 method for class 'daedalus_infection' set_data(x, ...) ## S3 method for class 'daedalus_vaccination' set_data(x, ...) set_data(x, ...)## S3 method for class 'daedalus_infection' set_data(x, ...) ## S3 method for class 'daedalus_vaccination' set_data(x, ...) set_data(x, ...)
x |
An S3 class object from the daedalus package of the
|
... |
< |
An S3 object of the same class as input x.
# simple example of setting all contacts to 1 country_A <- daedalus_country("United Kingdom") country_A disease_x <- daedalus_infection("sars_cov_1") disease_x <- set_data(disease_x, r0 = 3.0) disease_x# simple example of setting all contacts to 1 country_A <- daedalus_country("United Kingdom") country_A disease_x <- daedalus_infection("sars_cov_1") disease_x <- set_data(disease_x, r0 = 3.0) disease_x
Model output measures and groups for summaries and derived time-series
SUMMARY_MEASURES SUMMARY_GROUPSSUMMARY_MEASURES SUMMARY_GROUPS
An object of class character of length 3.
An object of class character of length 3.