| Title: | Stochastic compartmental model of mpox transmission |
|---|---|
| Description: | Stochastic compartmental model of mpox transmission in odin.dust. |
| Authors: | Lilith Whittles [aut, cre], Ruth McCabe [aut], Charlie Whittaker [aut], Ed Knock [aut], Kieran Chopra [aut], Imperial College of Science, Technology and Medicine [cph] |
| Maintainer: | Lilith Whittles <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.28 |
| Built: | 2026-05-24 07:09:49 UTC |
| Source: | https://github.com/mrc-ide/mpoxseir |
Divide matrix by population
div_pop(contact, population)div_pop(contact, population)
contact |
Matrix |
population |
Population vector |
Matrix
A function that gets the age bins used in the model.
get_age_bins()get_age_bins()
A data frame containing the labels for the age bins, and their start and end values
A function that gets the compartment indices used in the model
get_compartment_indices()get_compartment_indices()
A list containing entries: dim giving the dimensions of each
compartment, currently: group = 18, vax = 4;
group, a named list of the array indices corresponding to the
first dimension of model compartments: 16 5-year age bands + SW + PBS;
and vax, a named list of the vaccine strata used in
the second dimension of model compartments:
historic smallpox; 2. unvaccinated; 3. one-dose; 4. two-dose.
Use this function wherever you need to refer to these standards in your code to avoid duplication, and make modifying universally easier.
Process set of contact matrices -> mixing matrices
matrix_set(contact_matrix_set, population)matrix_set(contact_matrix_set, population)
contact_matrix_set |
Set of contact matrices |
population |
Vector of populaion by age |
Processed set of mixing matrices
The basic model; we may add more or adapt this one over time.
We need to map "dates" onto dust::dust's concept of model
"step" and we do this by mapping a date such as 2024-03-02 into
the number of days since the start of 2023 (426 here, with the 1st of
January being day 0). We call this integer number an "mpoxseir date".
mpoxseir_date(date) mpoxseir_date_as_date(date) as_mpoxseir_date(date) as_date(date)mpoxseir_date(date) mpoxseir_date_as_date(date) as_mpoxseir_date(date) as_date(date)
date |
A Date object, or something that can be converted to one, or an "mpoxseir date"; see Details |
There are several related functions here
mpoxseir_date converts its argument into an R Date object,
then applies this tranformation. If the argument is not a Date
object or a string representing one, an error will be thrown.
mpoxseir_date_to_date does the reverse conversion to
mpoxseir_date, converting an integer mpoxseir date into an R
Date
as_mpoxseir_date does the same conversion as mpoxseir_date
but will assume that an integer already represents an mpoxseir
date and will return it unmodified rather than erroring.
as_date does a string to date conversion, using as.Date()
but requiring the dates are in ISO 8601 (YYYY-MM-DD) format (it
is a helper that avoids conversion to NA, instead throwing an
error)
An integer, being the number of days into 2023
# Convert dates into mpoxseir dates: mpoxseir::mpoxseir_date("2023-01-01") mpoxseir::mpoxseir_date(c("2024-03-01", "2024-10-01")) # Reverse the conversion: mpoxseir::mpoxseir_date_as_date(0) mpoxseir::mpoxseir_date_as_date(c(425, 639)) # Double conversion not possible with mpoxseir_date... try(mpoxseir::mpoxseir_date(61)) # ...but allowed with as_mpoxseir_date mpoxseir::as_mpoxseir_date(61) # Strict date conversion with as_date mpoxseir::as_date("2024-03-01") try(mpoxseir::as_date("03-01-2024"))# Convert dates into mpoxseir dates: mpoxseir::mpoxseir_date("2023-01-01") mpoxseir::mpoxseir_date(c("2024-03-01", "2024-10-01")) # Reverse the conversion: mpoxseir::mpoxseir_date_as_date(0) mpoxseir::mpoxseir_date_as_date(c(425, 639)) # Double conversion not possible with mpoxseir_date... try(mpoxseir::mpoxseir_date(61)) # ...but allowed with as_mpoxseir_date mpoxseir::as_mpoxseir_date(61) # Strict date conversion with as_date mpoxseir::as_date("2024-03-01") try(mpoxseir::as_date("03-01-2024"))
A function that returns the demographic parameters for use in the model
parameters_demographic( region, mixing_matrix = "Zimbabwe", p_SW = NULL, p_HCW = NULL )parameters_demographic( region, mixing_matrix = "Zimbabwe", p_SW = NULL, p_HCW = NULL )
region |
The region for the parameters, must be either |
mixing_matrix |
The mixing matrix must be either |
p_SW |
The proportion of SW-age groups that are sex workers. Note that e.g. a value of 0.01 means 1% of all SW-age groups are sex workers and not just 1% of women in those groups. Default is NULL, in which case we use the default value for the region given in the package |
p_HCW |
The proportion of HCW-age groups that are healthcare workers. Default is NULL, in which the default values for DRC and Burundi are used. |
A list containing all the demographic parameters
A function that gets the fixed parameters for use in the model
parameters_fixed( region, initial_infections, use_ve_D = FALSE, mixing_matrix = "Zimbabwe", p_SW = NULL, p_HCW = NULL, overrides = list() )parameters_fixed( region, initial_infections, use_ve_D = FALSE, mixing_matrix = "Zimbabwe", p_SW = NULL, p_HCW = NULL, overrides = list() )
region |
The region for the parameters, must be either |
initial_infections |
The initial number of infections |
use_ve_D |
logical, indicating whether model should allow for vaccine efficacy against death (above and beyond protection against infection) |
mixing_matrix |
The mixing matrix must be either |
p_SW |
The proportion of SW-age groups that are sex workers. Note that e.g. a value of 0.01 means 1% of all SW-age groups are sex workers and not just 1% of women in those groups. Default is NULL, in which case we use the default value for the region given in the package |
p_HCW |
The proportion of HCW-age groups that are healthcare workers. Default is NULL, in which the default values for DRC and Burundi are used. |
overrides |
A list, containing any parameters for which you want to override the default values |
A list of the fixed parameters
Process a contact matrix
process_contact_matrix(contact_matrix, population)process_contact_matrix(contact_matrix, population)
contact_matrix |
A contact matrix |
population |
Vector of population by age |
Processed matrix
Process a contact matrix with an extra
process_contact_matrix_scaled_age(contact_matrix, population)process_contact_matrix_scaled_age(contact_matrix, population)
contact_matrix |
A contact matrix |
population |
Vector of population by age |
Processed matrix
min_age
and max_age (inclusive) based on uniform distribution within each age bandA function that calculates the proportion of each age group than lies inside a given interval
proportion_in_age_bins(min_age, max_age)proportion_in_age_bins(min_age, max_age)
min_age |
a scalar giving the bottom of the age range |
max_age |
a scalar giving the top of the age range |
a vector of length n_age = 16 giving the proportion for each age band
Run multiple iterations of the model with different parameter values
run_mpoxSEIR_targetedVax_multiple( region, initial_infections, n_weeks, beta_z_max, R0_hh, R0_sw_st, n_vax = 0, daily_doses = 0, N_prioritisation_steps = 0, prioritisation_strategy = 0, vaccination_coverage_target = 0, vaccine_uptake = 0, ve_T = 0, ve_I = 0, ve_D = 0, vaccination_campaign_length = 0, overrides = list(), n_particles = 1, n_threads = 1, seed = 42, deterministic = TRUE, outputs_retained = NULL )run_mpoxSEIR_targetedVax_multiple( region, initial_infections, n_weeks, beta_z_max, R0_hh, R0_sw_st, n_vax = 0, daily_doses = 0, N_prioritisation_steps = 0, prioritisation_strategy = 0, vaccination_coverage_target = 0, vaccine_uptake = 0, ve_T = 0, ve_I = 0, ve_D = 0, vaccination_campaign_length = 0, overrides = list(), n_particles = 1, n_threads = 1, seed = 42, deterministic = TRUE, outputs_retained = NULL )
region |
The region to run the model for, must be either |
initial_infections |
The initial number of infections to seed with |
n_weeks |
number of weeks to run for |
beta_z_max |
beta for the age-group with highest zoonotic transmission (a number) |
R0_hh |
R0 for the household |
R0_sw_st |
R0 for sex workers to people who buy sex |
n_vax |
number of vaccination compartments (integer, basis for an additional dimension in odin states) |
daily_doses |
the daily number of doses administered (matrix of vaccination_campaign_length * number of vaccination compartments) |
N_prioritisation_steps |
the number of different vaccination prioritisation categories we're considering |
prioritisation_strategy |
what each step corresponds to in terms of strategy (matrix of n_group * N_prioritisation_steps, with 1s and 0s indicating whether a group is included in prioritisation step) |
vaccination_coverage_target |
vaccination coverage target for each group and prioritisation step (matrix of n_group * N_prioritisation_steps) |
vaccine_uptake |
max achievable coverage for each group (vector of length n_group) |
ve_T |
vaccine efficacy against onwards transmissibility for each vaccinated compartment (vector of length n_vax) |
ve_I |
vaccine efficacy against infection for each vaccinated compartment (vector of length n_vax) |
ve_D |
vaccine efficacy against death for each vaccinated compartment (vector of length n_vax) |
vaccination_campaign_length |
length of the vaccination campaign (in timesteps NOT days - CHECK WITH RUTH THIS IS RIGHT) |
overrides |
list of other model parameters which if specified will overwrite the defaults |
n_particles |
Number of particles |
n_threads |
Number of threads |
seed |
The random seed to use |
deterministic |
Logical, whether to run the model deterministically or not |
outputs_retained |
The outputs to retain |
The output from running the model
Run the model with single set of parameter values
run_mpoxSEIR_targetedVax_single( region, initial_infections, n_weeks, R0_hh, R0_sw_st, beta_z_max, n_vax = 0, daily_doses = 0, N_prioritisation_steps = 0, prioritisation_strategy = 0, vaccination_coverage_target = 0, vaccine_uptake = 0, ve_T = 0, ve_I = 0, ve_D = 0, vaccination_campaign_length = 0, overrides = list(), n_particles = 1, n_threads = 1, seed = 42, deterministic = TRUE, outputs_retained = NULL )run_mpoxSEIR_targetedVax_single( region, initial_infections, n_weeks, R0_hh, R0_sw_st, beta_z_max, n_vax = 0, daily_doses = 0, N_prioritisation_steps = 0, prioritisation_strategy = 0, vaccination_coverage_target = 0, vaccine_uptake = 0, ve_T = 0, ve_I = 0, ve_D = 0, vaccination_campaign_length = 0, overrides = list(), n_particles = 1, n_threads = 1, seed = 42, deterministic = TRUE, outputs_retained = NULL )
region |
The region to run the model for, must be either |
initial_infections |
The initial number of infections to seed with |
n_weeks |
number of weeks to run for |
R0_hh |
R0 for the household |
R0_sw_st |
R0 for sex workers to people who buy sex |
beta_z_max |
beta for the age-group with highest zoonotic transmission (a number) |
n_vax |
number of vaccination compartments (integer, basis for an additional dimension in odin states) |
daily_doses |
the daily number of doses administered (matrix of vaccination_campaign_length * number of vaccination compartments) |
N_prioritisation_steps |
the number of different vaccination prioritisation categories we're considering |
prioritisation_strategy |
what each step corresponds to in terms of strategy (matrix of n_group * N_prioritisation_steps, with 1s and 0s indicating whether a group is included in prioritisation step) |
vaccination_coverage_target |
vaccination coverage target for each group and prioritisation step (matrix of n_group * N_prioritisation_steps) |
vaccine_uptake |
max achievable coverage for each group (vector of length n_group) |
ve_T |
vaccine efficacy against onwards transmissibility for each vaccinated compartment (vector of length n_vax) |
ve_I |
vaccine efficacy against infection for each vaccinated compartment (vector of length n_vax) |
ve_D |
vaccine efficacy against death for each vaccinated compartment (vector of length n_vax) |
vaccination_campaign_length |
length of the vaccination campaign (in timesteps NOT days - CHECK WITH RUTH THIS IS RIGHT) |
overrides |
list of other model parameters which if specified will overwrite the defaults |
n_particles |
Number of particles |
n_threads |
Number of threads |
seed |
The random seed to use |
deterministic |
Logical, whether to run the model deterministically or not |
outputs_retained |
The outputs to retain |
The output from running the model