Skip to contents

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.

All NPIs must be initialised with an associated country and infection; these are used to determine the state-values (hospital capacity) and incidence-prevalence ratio (IPR) at which the NPI starts and ends reactively.

Usage

daedalus_npi(
  name,
  country,
  infection,
  openness = NULL,
  start_time = 30,
  duration = 60
)

is_daedalus_npi(x)

# S3 method for class 'daedalus_npi'
print(x, ...)

Arguments

name

An NPI strategy name from among daedalus.data::closure_strategy_names, or NA. Passing a pre-defined strategy name automatically pulls in openness parameters for the associated response strategy; these are stored as packaged data in daedalus.data::closure_strategy_data. Pass NA to define a custom response strategy by passing a vector to openness.

country

A country or territory object of class <daedalus_country>, or a country or territory name from those included in the package; see daedalus.data::country_names, or a country ISO2 or ISO3 code; see daedalus.data::country_codes_iso2c and daedalus.data::country_codes_iso3c. Country-specific data such as the community and workplace contacts, the demography, and the distribution of the workforce into economic sectors is automatically accessed from package data for the relevant country name if it is passed as a string. To override package defaults for country characteristics, pass a <daedalus_country> object instead. See daedalus_country() for more.

infection

An infection parameter object of the class <daedalus_infection>, or an epidemic name for which data are provided in the package; see daedalus.data::epidemic_names for historical epidemics or epidemic waves for which parameters are available. Passing the name as a string automatically accesses the default parameters of an infection. Create and pass a <daedalus_infection> to tweak infection parameters using daedalus_infection().

openness

An optional numeric vector where all values are in the range \([0, 1]\), giving the openness of each economic sector in the model. Expected to have a length of N_ECON_SECTORS (currently 45).

start_time

The number of days after the start of the epidemic that the NPI response begins. Must be a single number. Defaults to 30. Passed to the time_on argument in new_daedalus_response() via the class constructor new_daedalus_npi().

duration

The maximum number of days that and NPI response is active, whether started by passing the start_time or when a state threshold is crossed. Defaults to 60 days.

x

An object to be tested or printed as a <daedalus_npi>.

...

For daedalus_npi(), other parameters passed to new_daedalus_response(). For the print method, other parameters passed to print().

Details

Note that NPIs are reactive to the model state (i.e., the epidemic state), and can trigger when state conditions are met.

Examples

# for a school closure strategy
daedalus_npi("school_closures", "GBR", "sars_cov_1")
#> <daedalus_npi/daedalus_response>
#> NPI strategy: school_closures
#>  Start time (days): 30
#>  Openness (mean prop.): 0.93
#>  Default duration (days): 60

# set custom openness
daedalus_npi(
  NA,
  "GBR", "sars_cov_1",
  openness = rep(0.1, 45)
)
#> <daedalus_npi/daedalus_response>
#> NPI strategy: custom
#>  Start time (days): 30
#>  Openness (mean prop.): 0.1
#>  Default duration (days): 60