Parameters for the "lancelot" model.

lancelot_parameters(
  start_date,
  region,
  beta_date = NULL,
  beta_value = NULL,
  beta_type = "piecewise-linear",
  population = NULL,
  carehome_beds = NULL,
  severity = NULL,
  progression = NULL,
  observation = NULL,
  sens_and_spec = NULL,
  initial_seed_size = 30,
  initial_seed_pattern = 1,
  eps = 0.1,
  m_CHW = 4e-06,
  m_CHR = 5e-05,
  strain_transmission = 1,
  strain_seed_date = NULL,
  strain_seed_size = NULL,
  strain_seed_pattern = NULL,
  strain_rel_gamma_E = 1,
  strain_rel_gamma_A = 1,
  strain_rel_gamma_P = 1,
  strain_rel_gamma_C_1 = 1,
  strain_rel_gamma_C_2 = 1,
  strain_rel_gamma_PCR_pre = 1,
  strain_rel_gamma_PCR_pos = 1,
  strain_rel_p_sympt = 1,
  strain_rel_p_hosp_if_sympt = 1,
  strain_rel_p_icu = 1,
  strain_rel_p_death = 1,
  strain_rel_p_G_D = 1,
  rel_susceptibility = 1,
  rel_p_sympt = 1,
  rel_p_hosp_if_sympt = 1,
  rel_p_death = 1,
  rel_infectivity = 1,
  vaccine_progression_rate = NULL,
  vaccine_schedule = NULL,
  vaccine_index_dose2 = NULL,
  vaccine_index_booster = NULL,
  vaccine_catchup_fraction = 1,
  n_doses = 2L,
  vacc_skip_progression_rate = NULL,
  vacc_skip_to = NULL,
  vacc_skip_weight = NULL,
  waning_rate = 0,
  exp_noise = 1e+06,
  cross_immunity = 1
)

Arguments

start_date

The start date, as a sircovid_date() (i.e., the number of days into 2020)

region

The region to run the model for. This will bee used to get population data, which is currently fixed within the package and is limited to "uk", the four constituent nations ("england", "wales", "scotland", "northern_ireland") and the 7 NHS regions (e.g., "midlands"). These names are case insensitive.

beta_date

A vector of dates (each as a sircovid_date()) for changes in beta (the contact rate parameter), or NULL if a single value is used for all times (see sircovid_parameters_piecewise_linear() or sircovid_parameters_piecewise_constant(), where this is passed as date). If beta_type = "piecewise-constant", then the first date must be 0.

beta_value

A vector of values for beta (the contact rate parameter). If not given, and if beta_date is NULL then a value of 0.1 will be used through the whole simulation, otherwise if beta_date is NULL this must be a scalar. If beta_date is given then beta_date and beta_value must have the same length (see sircovid_parameters_piecewise_linear() or sircovid_parameters_piecewise_constant(), where this is passed as value).

beta_type

The type of form used for beta (the contact rate parameter), which currently can be "piecewise-linear" or "piecewise-constant"

population

Population data. A vector of length 17 for the population size for age groups 0-4, 5-9, ..., 75-79, 80+. If NULL, the population data will be sourced within the package for the specified region (only if available).

carehome_beds

The number of care home beds in the region. If NULL, this will be sourced within the package for the specified region (only if available).

severity

Severity data, via Bob Verity's markovid package. This needs to be NULL (use the default bundled data version in the package), a data.frame object (for raw severity data) or a list (for data that has already been processed by sircovid for use). New severity data comes from Bob Verity via the markovid package, and needs to be carefully calibrated with the progression parameters.

progression

Progression data

observation

Either NULL or a list of observation parameters. If NULL, then a list of observation parameters will be generated using lancelot_parameters_observation(exp_noise)

sens_and_spec

Either NULL or a list of diagnostic test sensitivity and specificity parameters. If NULL, then a list of sensitivity and specificity parameters will be generated using lancelot_parameters_sens_and_spec()

initial_seed_size

Initial size of seeding from the S to E compartment; all seeding is in the 15-19 year old group from start_date according to initial_seed_pattern. The default is 30.

initial_seed_pattern

A vector of seeding weights for the initial seeding. The length represents the number of steps to seed over from the start_date, and the initial_seed_size is split over these steps according to those weights. If start_date is not a multiple of the step size (and thus falls between two steps) then we weight over an additional step and adjust the weights according to how far the start_date is from the previous full step.

eps

Change in contact rate for carehome residents

m_CHW

Contact rate between carehome workers and either residents or workers

m_CHR

Contact rate between carehome residents

strain_transmission

Vector of length two for relative transmissibility of each strain modelled. Length will define the number of strains used in the model, either 1 or 2.

strain_seed_date

Either NULL (no seeding) or a sircovid_date corresponding to the date the seeding of strain 2 begins.

strain_seed_size

Either NULL (no seeding) or the size of strain 2 seeding from the S to E compartment; all seeding is in the 15-19 year old group from strain_seed_date according to strain_seed_pattern.

strain_seed_pattern

Either NULL (no seeding) or a vector of seeding weights for the initial seeding. The length represents the number of steps to seed over from the start_date, and the strain_seed_size is split over these steps according to those weights. If start_seed_date is not a multiple of the step size (and thus falls between two steps) then we weight over an additional step and adjust the weights according to how far the strain_seed_date is from the previous full step.

strain_rel_gamma_E

Vector of relative rates of progression out of E (gamma_E) for each strain modelled. If 1 all strains have same rates. Otherwise vector of same length as strain_transmission, with entries that determines the relative scaling of the defaults for each strain.

strain_rel_gamma_A

Vector of relative rates of progression out of I_A (gamma_A) for each strain modelled. If 1 all strains have same rates. Otherwise vector of same length as strain_transmission, with entries that determines the relative scaling of the defaults for each strain.

strain_rel_gamma_P

Vector of relative rates of progression out of I_P (gamma_P) for each strain modelled. If 1 all strains have same rates. Otherwise vector of same length as strain_transmission, with entries that determines the relative scaling of the defaults for each strain.

strain_rel_gamma_C_1

Vector of relative rates of progression out of I_C_1 (gamma_C_1) for each strain modelled. If 1 all strains have same rates. Otherwise vector of same length as strain_transmission, with entries that determines the relative scaling of the defaults for each strain.

strain_rel_gamma_C_2

Vector of relative rates of progression out of I_C_2 (gamma_C_2) for each strain modelled. If 1 all strains have same rates. Otherwise vector of same length as strain_transmission, with entries that determines the relative scaling of the defaults for each strain.

strain_rel_gamma_PCR_pre

Vector of relative rates of PCR pre-positive duration for each strain modelled. if '1' all strains have same rates. Otherwise vector of same length as strain_transmission, with entries that determines the relative scaling of the defaults for each strain.

strain_rel_gamma_PCR_pos

Vector of relative rates of PCR positivity duration for each strain modelled. if '1' all strains have same rates. Otherwise vector of same length as strain_transmission, with entries that determines the relative scaling of the defaults for each strain.

strain_rel_p_sympt

Vector of relative probabilities of symptoms for each strain modelled. If 1 all strains have same probabilities of symptoms. Otherwise vector of same length as strain_transmission, where the first value should be 1 (for the first strain) and subsequent values between 0 and 1. In this case parameters will be "mirrored" for pseudostrains i.e. the relative probability of symptoms will be assume the same irrespective of previous infection with another strain. Alternatively, a vector of twice the length of strain_transmission can be provided to allow specifying directly relative probability of symptoms for each pseudostrain (with strain 3 - 1.2 and strain 4 = 2.1). To ensure valid probabilities, p_sympt is upper-truncated at 1 after scaling.

strain_rel_p_hosp_if_sympt

Vector of relative probabilities of hospitalisation given symptoms for each strain modelled. If 1 all strains have same probabilities of hospitalisation. Otherwise vector of same length as strain_transmission, where the first value should be 1 (for the first strain) and subsequent values between 0 and 1. In this case parameters will be "mirrored" for pseudostrains i.e. the relative probability of hospitalisation will be assume the same irrespective of previous infection with another strain. Alternatively, a vector of twice the length of strain_transmission can be provided to allow specifying directly relative probability of hospitalisation for each pseudostrain (with strain 3 - 1.2 and strain 4 = 2.1). To ensure valid probabilities, p_hosp_if_sympt is upper-truncated at 1 after scaling.

strain_rel_p_icu

Vector of relative probabilities of icu given hospitalised for each strain modelled. If 1 all strains have same probabilities of icu admission. Otherwise vector of same length as strain_transmission, where the first value should be 1 (for the first strain) and subsequent values between 0 and 1. In this case parameters will be "mirrored" for pseudostrains i.e. the relative probability of icu admission will be assume the same irrespective of previous infection with another strain. Alternatively, a vector of twice the length of strain_transmission can be provided to allow specifying directly relative probability of icu admission for each pseudostrain (with strain 3 - 1.2 and strain 4 = 2.1). To ensure valid probabilities, p_icu is upper-truncated at 1 after scaling.

strain_rel_p_death

Vector of relative probabilities of death for each strain modelled. If 1 all strains have same probabilities of death. Otherwise vector of same length as strain_transmission, where the first value should be 1 (for the first strain) and subsequent values between 0 and 1. In this case parameters will be "mirrored" for pseudostrains i.e. the relative probability of death will be assume the same irrespective of previous infection with another strain. Alternatively, a vector of twice the length of strain_transmission can be provided to allow specifying directly relative probability of death for each pseudostrain (with strain 3 - 1.2 and strain 4 = 2.1). To ensure valid probabilities, p_death is upper-truncated at 1 after scaling.

strain_rel_p_G_D

Vector of relative probabilities of death in the coummunity for each strain modelled. If 1 all strains have same probabilities of death. Otherwise vector of same length as strain_transmission, where the first value should be 1 (for the first strain) and subsequent values between 0 and 1. In this case parameters will be "mirrored" for pseudostrains i.e. the relative probability of death will be assume the same irrespective of previous infection with another strain. Alternatively, a vector of twice the length of strain_transmission can be provided to allow specifying directly relative probability of death for each pseudostrain (with strain 3 - 1.2 and strain 4 = 2.1). To ensure valid probabilities, p_G_D is upper-truncated at 1 after scaling.

rel_susceptibility

A vector or array of values representing the relative susceptibility of individuals in different vaccination groups. If a vector, the first value should be 1 (for the non-vaccinated group) and subsequent values be between 0 and 1. In that case relative susceptibility will be the same across all age groups within one vaccination category, and will be the same for all pathogen strains. Specifying an array instead of a vector allows different relative susceptibilities by age (first dimension of the array), pathogen strain (second dimension) and vaccination group (third dimension); in that case, the first layer (3rd dimension) of rel_susceptibility should be 1 (for the non-vaccinated group) for the first column (first infection with first strain) and other values between 0 and 1

rel_p_sympt

A vector or matrix of values of same dimension as rel_susceptibility representing the relative probability of symptomatic infection in different vaccination groups. If a vector, the first value should be 1 (for the non-vaccinated group) and subsequent values be between 0 and 1. In that case the relative reduction in probability of symptomatic infection will be the same across all age groups and all strains within one vaccination category. Specifying an array instead of a vector allows different relative reductions in probability of symptomatic infection by age (first dimension of the array), pathogen strain (second dimension) and vaccination group (third dimension); in that case, the first layer of rel_p_sympt should be 1 (for the non-vaccinated group) for the first column (first infection with first strain) and other values between 0 and 1

rel_p_hosp_if_sympt

A vector or array of values of same dimension as rel_susceptibility representing the relative probability of hospitalisation for symptomatic cases in different vaccination groups. If a vector, the first value should be 1 (for the non-vaccinated group) and subsequent values be between 0 and 1. In that case the relative reduction in probability of hospitalisation for symptomatic cases will be the same across all age groups and all strains within one vaccination category. Specifying an array instead of a vector allows different relative reductions in probability of hospitalisation for symptomatic cases by age (first dimension of the array), pathogen strain (second dimension) and vaccination group (third dimension); in that case, the first layer of rel_p_hosp_if_sympt should be 1 (for the non-vaccinated group) for the first column (first infection with first strain) and other values between 0 and 1

rel_p_death

A vector or array of values of same dimension as rel_susceptibility representing the relative probability of death for severe cases (either in hospital or the community) in different vaccination groups. If a vector, the first value should be 1 (for the non-vaccinated group) and subsequent values be between 0 and 1. In that case the relative reduction in probability of death for severe cases will be the same across all age groups and all strains within one vaccination category. Specifying an array instead of a vector allows different relative reductions in probability of death for severe cases by age (first dimension of the array), pathogen strain (second dimension) and vaccination group (third dimension); in that case, the first layer of rel_p_death should be 1 (for the non-vaccinated group) for the first column (first infection with first strain) and other values between 0 and 1

rel_infectivity

A vector or array of values representing the relative infectivity of individuals in different vaccination groups, if they are infected. If a vector, the first value should be 1 (for the non-vaccinated group) and subsequent values be between 0 and 1. In that case relative infectivity will be the same across all age groups and all strains within one vaccination category. Specifying an array instead of a vector allows different relative infectivities by age (first dimension of the array), pathogen strain (second dimension) and vaccination group (third dimension); in that case, the first layer of rel_infectivity should be 1 (for the non-vaccinated group) for the first column (first infection with first strain) and other values between 0 and 1

vaccine_progression_rate

A vector or matrix of values of same dimension as rel_susceptibility representing the rate of movement between different vaccination classes. If a vector, it should have as many values as vaccination classes, and the same rates of progression will be used for all age groups (the first rate is the vaccination rate and the last of the rates is the rate of returning to the initial vacination class); if a matrix, the element on row i and column j is the rate of progression from the jth vaccination class to the (j+1)th for age group i.

vaccine_schedule

A vaccine_schedule object indicating the people to be vaccinated by group over time

vaccine_index_dose2

The index to use for the second dose

vaccine_index_booster

The indices to use for the booster doses

vaccine_catchup_fraction

A value between 0 and 1 indicating the proportion of doses not distributed according to schedule (e.g. because too many people were in the I or H compartments and could not be vaccinated at the scheduled time) that we postpone to a later date. A value of 0 means we do not catch up at all on any missed doses; a value of 1 means we try to catch up for all missed doses. This is set to 1 by default

n_doses

Number of doses given out, including boosters. Default is 2.

vacc_skip_progression_rate

A vector of length equal to the number of vaccine strata. Represents the base progression rate for "vaccine skip moves" from each strata. The rate is assumed to be the same across all age groups. Must be 0 for all j for which vacc_skip[j] = 0. Default is a vector of 0s

vacc_skip_to

A vector of integers of length equal to the number of vaccine strata. The value of vacc_skip_to[j] represents the vaccine stratum an individual in vaccine stratum j can move to in a "vaccine skip move". Values can be 0 (which mean there is no vaccine skip move from that stratum), or greater than or equal to j + 2 (we already account for moves between successive vaccine strata). More than one vaccine skip move to the same vaccine stratum is not allowed, so all non-zero values in vacc_skip_to must be unique. Overlapping vaccine skip moves are also not allowed - if a there is a vaccine skip move from i to j there can be no vaccine skip moves from stratum k where i < k < j. For example, having vaccine skip moves from 2 to 4 and 3 to 5 would not be allowed, but moves from 2 to 4 and 4 to 6 would be allowed. Default is a vector of 0s

vacc_skip_weight

A vector of weights of length equal to the number of vaccine strata. If movement into vacc_skip_to[j] from vacc_skip_to[j] - 1 is controlled by doses, then the "vaccine skip move" is too, and the weight represents how much those in strata j are weighted in dose distribution relative to those in vacc_skip_to - 1. Must be between 0 and 1. Must be 0 for any j for which vacc_skip_to = 0. Default is a vector of 0s

waning_rate

A single value or a vector of values representing the rates of waning of immunity after infection; if a single value the same rate is used for all age groups; if a vector of values if used it should have one value per age group.

exp_noise

Rate of exponential noise used in the compare function - typically set to a large value so that noise is small but non-zero. If set to Inf then there is no noise in the observation process (not realistic but useful for testing).

cross_immunity

A value or vector of same length as strain_transmission that controls the amount of immunity conferred by previous infection with one strain. If a scalar is given then same level of cross immunity is assumed between both strains. Otherwise a vector of length two should be provided where the first value is the relative protection against infection with strain 2 following infection with strain 1 (i.e. while in the R1 compartment), and vice versa for the second value. Values between 0 and 1 are allowed with values of 1 (default) indicating complete cross-immunity, and values of 0 mean no cross-immunity. Modelling 'superinfections' (being exposed to one strain after recovering from another) can be turned off by setting cross_immunity = 1.

Value

A list of inputs to the model, many of which are fixed and represent data. These correspond largely to user() calls within the odin code, though some are also used in processing just before the model is run.

Examples


region <- "london"
lancelot_parameters(sircovid_date("2020-02-01"), region)

# example set up of vaccination parameters independent of age
# 3 groups: 1) unvaccinated, 2) vaccinated with partial immunity
# 3) fully vaccinated (but with an imperfect vaccine). People return
# to group 1 after a period of time in group 3 to mirror waning immunity

# Assumption: immediately after vaccination susceptibility is reduced by
# 20%, and then by 50% when you reach full effect of the vaccination,
# then susceptibility returns to 100% upon waning of vaccine=induced
# immunity
# effect of vaccination similar across all age groups
rel_susceptibility <- c(1, 0.8, 0.5)

# The vaccine also reduces the risk of symptoms
rel_p_sympt <- c(1, 0.6, 0.3)
# and the risk of hospitalisation for those with symptoms
rel_p_hosp_if_sympt <- c(1, 0.95, 0.95)
# and the risk of death for those with severe disease
rel_p_death <- c(1, 0.9, 0.9)

# The vaccine also reduces infectivity of infected individuals by half
rel_infectivity <- c(1, 0.5, 0.5)

# On average 10000 first doses of vaccine are given every day
# Second doses are given on average 12 weeks after the first dose
# vaccine-induced immunity wanes after a period which is exponentially
# distributed and lasts on average 26 weeks (half a year);
# they are similar across all age groups
vaccine_progression_rate <- c(0, 0, 1/(26*7))

daily_doses <- rep(10000, 365)
mean_days_between_doses <- 12 * 7
n <- vaccine_priority_population(region, uptake = 1)
schedule <- vaccine_schedule_future(
  0, daily_doses, mean_days_between_doses, n)

# generate model parameters
p <- lancelot_parameters(
       sircovid_date("2020-02-01"), region,
       rel_susceptibility = rel_susceptibility,
       rel_p_sympt = rel_p_sympt,
       rel_p_hosp_if_sympt = rel_p_hosp_if_sympt,
       rel_p_death = rel_p_death,
       rel_infectivity = rel_infectivity,
       vaccine_progression_rate = vaccine_progression_rate,
       vaccine_schedule = schedule,
       vaccine_index_dose2 = 2)

# vaccination parameters are automatically copied across all age groups#
# (and across strains but here we only have 1 strain which is the 2nd
# dimension here)
p$rel_susceptibility
#> , , 1
#> 
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> 
#> , , 2
#> 
#>       [,1]
#>  [1,]  0.8
#>  [2,]  0.8
#>  [3,]  0.8
#>  [4,]  0.8
#>  [5,]  0.8
#>  [6,]  0.8
#>  [7,]  0.8
#>  [8,]  0.8
#>  [9,]  0.8
#> [10,]  0.8
#> [11,]  0.8
#> [12,]  0.8
#> [13,]  0.8
#> [14,]  0.8
#> [15,]  0.8
#> [16,]  0.8
#> [17,]  0.8
#> [18,]  0.8
#> [19,]  0.8
#> 
#> , , 3
#> 
#>       [,1]
#>  [1,]  0.5
#>  [2,]  0.5
#>  [3,]  0.5
#>  [4,]  0.5
#>  [5,]  0.5
#>  [6,]  0.5
#>  [7,]  0.5
#>  [8,]  0.5
#>  [9,]  0.5
#> [10,]  0.5
#> [11,]  0.5
#> [12,]  0.5
#> [13,]  0.5
#> [14,]  0.5
#> [15,]  0.5
#> [16,]  0.5
#> [17,]  0.5
#> [18,]  0.5
#> [19,]  0.5
#> 
p$rel_p_sympt
#> , , 1
#> 
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> 
#> , , 2
#> 
#>       [,1]
#>  [1,]  0.6
#>  [2,]  0.6
#>  [3,]  0.6
#>  [4,]  0.6
#>  [5,]  0.6
#>  [6,]  0.6
#>  [7,]  0.6
#>  [8,]  0.6
#>  [9,]  0.6
#> [10,]  0.6
#> [11,]  0.6
#> [12,]  0.6
#> [13,]  0.6
#> [14,]  0.6
#> [15,]  0.6
#> [16,]  0.6
#> [17,]  0.6
#> [18,]  0.6
#> [19,]  0.6
#> 
#> , , 3
#> 
#>       [,1]
#>  [1,]  0.3
#>  [2,]  0.3
#>  [3,]  0.3
#>  [4,]  0.3
#>  [5,]  0.3
#>  [6,]  0.3
#>  [7,]  0.3
#>  [8,]  0.3
#>  [9,]  0.3
#> [10,]  0.3
#> [11,]  0.3
#> [12,]  0.3
#> [13,]  0.3
#> [14,]  0.3
#> [15,]  0.3
#> [16,]  0.3
#> [17,]  0.3
#> [18,]  0.3
#> [19,]  0.3
#> 
p$rel_p_hosp_if_sympt
#> , , 1
#> 
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> 
#> , , 2
#> 
#>       [,1]
#>  [1,] 0.95
#>  [2,] 0.95
#>  [3,] 0.95
#>  [4,] 0.95
#>  [5,] 0.95
#>  [6,] 0.95
#>  [7,] 0.95
#>  [8,] 0.95
#>  [9,] 0.95
#> [10,] 0.95
#> [11,] 0.95
#> [12,] 0.95
#> [13,] 0.95
#> [14,] 0.95
#> [15,] 0.95
#> [16,] 0.95
#> [17,] 0.95
#> [18,] 0.95
#> [19,] 0.95
#> 
#> , , 3
#> 
#>       [,1]
#>  [1,] 0.95
#>  [2,] 0.95
#>  [3,] 0.95
#>  [4,] 0.95
#>  [5,] 0.95
#>  [6,] 0.95
#>  [7,] 0.95
#>  [8,] 0.95
#>  [9,] 0.95
#> [10,] 0.95
#> [11,] 0.95
#> [12,] 0.95
#> [13,] 0.95
#> [14,] 0.95
#> [15,] 0.95
#> [16,] 0.95
#> [17,] 0.95
#> [18,] 0.95
#> [19,] 0.95
#> 
p$rel_p_death
#> , , 1
#> 
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> 
#> , , 2
#> 
#>       [,1]
#>  [1,]  0.9
#>  [2,]  0.9
#>  [3,]  0.9
#>  [4,]  0.9
#>  [5,]  0.9
#>  [6,]  0.9
#>  [7,]  0.9
#>  [8,]  0.9
#>  [9,]  0.9
#> [10,]  0.9
#> [11,]  0.9
#> [12,]  0.9
#> [13,]  0.9
#> [14,]  0.9
#> [15,]  0.9
#> [16,]  0.9
#> [17,]  0.9
#> [18,]  0.9
#> [19,]  0.9
#> 
#> , , 3
#> 
#>       [,1]
#>  [1,]  0.9
#>  [2,]  0.9
#>  [3,]  0.9
#>  [4,]  0.9
#>  [5,]  0.9
#>  [6,]  0.9
#>  [7,]  0.9
#>  [8,]  0.9
#>  [9,]  0.9
#> [10,]  0.9
#> [11,]  0.9
#> [12,]  0.9
#> [13,]  0.9
#> [14,]  0.9
#> [15,]  0.9
#> [16,]  0.9
#> [17,]  0.9
#> [18,]  0.9
#> [19,]  0.9
#> 
p$rel_infectivity
#> , , 1
#> 
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> 
#> , , 2
#> 
#>       [,1]
#>  [1,]  0.5
#>  [2,]  0.5
#>  [3,]  0.5
#>  [4,]  0.5
#>  [5,]  0.5
#>  [6,]  0.5
#>  [7,]  0.5
#>  [8,]  0.5
#>  [9,]  0.5
#> [10,]  0.5
#> [11,]  0.5
#> [12,]  0.5
#> [13,]  0.5
#> [14,]  0.5
#> [15,]  0.5
#> [16,]  0.5
#> [17,]  0.5
#> [18,]  0.5
#> [19,]  0.5
#> 
#> , , 3
#> 
#>       [,1]
#>  [1,]  0.5
#>  [2,]  0.5
#>  [3,]  0.5
#>  [4,]  0.5
#>  [5,]  0.5
#>  [6,]  0.5
#>  [7,]  0.5
#>  [8,]  0.5
#>  [9,]  0.5
#> [10,]  0.5
#> [11,]  0.5
#> [12,]  0.5
#> [13,]  0.5
#> [14,]  0.5
#> [15,]  0.5
#> [16,]  0.5
#> [17,]  0.5
#> [18,]  0.5
#> [19,]  0.5
#> 
# Note that this is only the "base" rate as we fill in the first
# column dynamically based on vaccine_daily_doses
p$vaccine_progression_rate
#>       [,1] [,2]        [,3]
#>  [1,]    0    0 0.005494505
#>  [2,]    0    0 0.005494505
#>  [3,]    0    0 0.005494505
#>  [4,]    0    0 0.005494505
#>  [5,]    0    0 0.005494505
#>  [6,]    0    0 0.005494505
#>  [7,]    0    0 0.005494505
#>  [8,]    0    0 0.005494505
#>  [9,]    0    0 0.005494505
#> [10,]    0    0 0.005494505
#> [11,]    0    0 0.005494505
#> [12,]    0    0 0.005494505
#> [13,]    0    0 0.005494505
#> [14,]    0    0 0.005494505
#> [15,]    0    0 0.005494505
#> [16,]    0    0 0.005494505
#> [17,]    0    0 0.005494505
#> [18,]    0    0 0.005494505
#> [19,]    0    0 0.005494505

### same example as above BUT assume a different effect of vaccine in the
### first age group
n_groups <- 19
n_strains <- 1

# Assumption: vaccine is twice more effective at reducing susceptibility
# in the first age group
rel_susceptibility_agegp1 <- c(1, 0.4, 0.25)
rel_susceptibility_other_agegp <- c(1, 0.8, 0.5)
rel_susceptibility <- array(NA, dim = c(n_groups, n_strains, 3))
rel_susceptibility[1, , ] <- rel_susceptibility_agegp1
for (i in seq(2, n_groups)) {
  rel_susceptibility[i, , ] <- rel_susceptibility_other_agegp
}
rel_susceptibility
#> , , 1
#> 
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> 
#> , , 2
#> 
#>       [,1]
#>  [1,]  0.4
#>  [2,]  0.8
#>  [3,]  0.8
#>  [4,]  0.8
#>  [5,]  0.8
#>  [6,]  0.8
#>  [7,]  0.8
#>  [8,]  0.8
#>  [9,]  0.8
#> [10,]  0.8
#> [11,]  0.8
#> [12,]  0.8
#> [13,]  0.8
#> [14,]  0.8
#> [15,]  0.8
#> [16,]  0.8
#> [17,]  0.8
#> [18,]  0.8
#> [19,]  0.8
#> 
#> , , 3
#> 
#>       [,1]
#>  [1,] 0.25
#>  [2,] 0.50
#>  [3,] 0.50
#>  [4,] 0.50
#>  [5,] 0.50
#>  [6,] 0.50
#>  [7,] 0.50
#>  [8,] 0.50
#>  [9,] 0.50
#> [10,] 0.50
#> [11,] 0.50
#> [12,] 0.50
#> [13,] 0.50
#> [14,] 0.50
#> [15,] 0.50
#> [16,] 0.50
#> [17,] 0.50
#> [18,] 0.50
#> [19,] 0.50
#> 

# But vaccine has the same impact on probability of symptoms and
# hospitalisation for the symptomatic across all age groups
rel_p_sympt <- array(rep(rel_p_sympt, each = n_groups),
  dim = c(n_groups, n_strains, 3))
rel_p_hosp_if_sympt <-
  array(rep(rel_p_hosp_if_sympt, each = n_groups),
  dim = c(n_groups, n_strains, 3))
rel_p_death <-
  array(rep(rel_p_hosp_if_sympt, each = n_groups),
  dim = c(n_groups, n_strains, 3))

# And vaccine has the same impact on onwards infectivity across age groups
rel_infectivity <- array(rep(rel_infectivity, each = n_groups),
  dim = c(n_groups, n_strains, 3))

# the period of build-up of immunity is the same for all age groups,
# lasting on average 2 weeks,
# but the first age group loses immunity more quickly
# (on average after 3 months) than the other age groups
# (on average after 6 months)
vaccine_progression_rate <- cbind(0, 0,
                                  c(1 / (13 * 7),
                                  rep( 1 / (26 * 7), n_groups - 1)))

# generate model parameters
p <- lancelot_parameters(
       sircovid_date("2020-02-01"), region,
       rel_susceptibility = rel_susceptibility,
       rel_p_sympt = rel_p_sympt,
       rel_p_hosp_if_sympt = rel_p_hosp_if_sympt,
       rel_p_death = rel_p_death,
       rel_infectivity = rel_infectivity,
       vaccine_progression_rate = vaccine_progression_rate,
       vaccine_schedule = schedule,
       vaccine_index_dose2 = 2)

# TODO: add an example of manually set up vaccine schedule