Skip to contents

ModelMeaslesMixing creates a measles epidemiological model with mixing between different population groups. The model includes vaccination, quarantine, isolation, and contact tracing mechanisms.

Usage

ModelMeaslesMixing(
  n,
  prevalence,
  contact_matrix,
  vax_reduction_recovery_rate = 0.5,
  transmission_rate = 0.9,
  contact_rate = 15/transmission_rate/prodromal_period,
  prop_vaccinated,
  vax_efficacy = 0.99,
  quarantine_period = 21,
  quarantine_willingness = 1,
  isolation_willingness = 1,
  isolation_period = 4,
  incubation_period = 12,
  prodromal_period = 4,
  rash_period = 3,
  hospitalization_rate = 0.2,
  hospitalization_period = 7,
  days_undetected = 2,
  contact_tracing_success_rate = 1,
  contact_tracing_days_prior = 4
)

Arguments

n

Number of individuals in the population.

prevalence

Double. Initial proportion of individuals with the virus.

contact_matrix

A row-stochastic matrix of mixing proportions between population groups.

vax_reduction_recovery_rate

Double. Vaccine reduction in recovery rate (default: 0.5).

transmission_rate

Numeric scalar between 0 and 1. Probability of transmission (default: 0.9).

contact_rate

Numeric scalar. Average number of contacts per step.

prop_vaccinated

Double. Proportion of population that is vaccinated.

vax_efficacy

Double. Vaccine efficacy rate (default: 0.99).

quarantine_period

Integer. Number of days for quarantine (default: 21).

quarantine_willingness

Double. Proportion of agents willing to quarantine (default: 1).

isolation_willingness

Double. Proportion of agents willing to isolate (default: 1).

isolation_period

Integer. Number of days for isolation (default: 4).

incubation_period

Double. Duration of incubation period (default: 12).

prodromal_period

Double. Duration of prodromal period (default: 4).

rash_period

Double. Duration of rash period (default: 3).

hospitalization_rate

Double. Rate of hospitalization (default: 0.2).

hospitalization_period

Double. Period of hospitalization (default: 7).

days_undetected

Double. Number of days an infection goes undetected (default: 2).

contact_tracing_success_rate

Double. Probability of successful contact tracing (default: 1.0).

contact_tracing_days_prior

Integer. Number of days prior to the onset of the infection for which contact tracing is effective (default: 4).

Value

  • The ModelMeaslesMixing function returns a model of classes epiworld_model and epiworld_measlesmixing.

Details

The contact_matrix is a matrix of contact rates between entities. The matrix should be of size n x n, where n is the number of entities. This is a row-stochastic matrix, i.e., the sum of each row should be 1.

The model includes three distinct phases of measles infection: incubation, prodromal, and rash periods. Vaccination provides protection against infection and may reduce recovery time.

The initial_states function allows the user to set the initial state of the model. In particular, the user can specify how many of the non-infected agents have been removed at the beginning of the simulation.

The default value for the contact rate is an approximation to the disease's basic reproduction number (R0), but it is not 100% accurate. A more accurate way to se the contact rate is available, and will be distributed in the future.

Examples


# Start off creating three entities.
# Individuals will be distributed randomly between the three.
e1 <- entity("Population 1", 3e3, as_proportion = FALSE)
e2 <- entity("Population 2", 3e3, as_proportion = FALSE)
e3 <- entity("Population 3", 3e3, as_proportion = FALSE)

# Row-stochastic matrix (rowsums 1)
cmatrix <- c(
  c(0.9, 0.05, 0.05),
  c(0.1, 0.8, 0.1),
  c(0.1, 0.2, 0.7)
) |> matrix(byrow = TRUE, nrow = 3)

N <- 9e3

measles_model <- ModelMeaslesMixing(
  n                        = N,
  prevalence               = 1 / N,
  contact_rate             = 15,
  transmission_rate        = 0.9,
  vax_efficacy             = 0.97,
  vax_reduction_recovery_rate = 0.8,
  incubation_period        = 10,
  prodromal_period         = 3,
  rash_period              = 7,
  contact_matrix           = cmatrix,
  hospitalization_rate     = 0.1,
  hospitalization_period   = 10,
  days_undetected          = 2,
  quarantine_period        = 14,
  quarantine_willingness   = 0.9,
  isolation_willingness    = 0.8,
  isolation_period         = 10,
  prop_vaccinated          = 0.95,
  contact_tracing_success_rate = 0.8,
  contact_tracing_days_prior = 4
)

# Adding the entities to the model
measles_model |>
  add_entity(e1) |>
  add_entity(e2) |>
  add_entity(e3)

set.seed(331)
run(measles_model, ndays = 100)
#> _________________________________________________________________________
#> Running the model...
#> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| done.
summary(measles_model)
#> ________________________________________________________________________________
#> ________________________________________________________________________________
#> SIMULATION STUDY
#> 
#> Name of the model   : Measles with Mixing and Quarantine
#> Population size     : 9000
#> Agents' data        : (none)
#> Number of entities  : 3
#> Days (duration)     : 100 (of 100)
#> Number of viruses   : 1
#> Last run elapsed t  : 133.00ms
#> Last run speed      : 6.72 million agents x day / second
#> Rewiring            : off
#> 
#> Global events:
#>  - Update infected individuals (runs daily)
#> 
#> Virus(es):
#>  - Measles
#> 
#> Tool(s):
#>  - Vaccine
#> 
#> Model parameters:
#>  - (IGNORED) Vax improved recovery : 0.8000
#>  - Contact rate                    : 15.0000
#>  - Contact tracing days prior      : 4.0000
#>  - Contact tracing success rate    : 0.8000
#>  - Days undetected                 : 2.0000
#>  - Hospitalization period          : 10.0000
#>  - Hospitalization rate            : 0.1000
#>  - Incubation period               : 10.0000
#>  - Isolation period                : 10.0000
#>  - Isolation willingness           : 0.8000
#>  - Prodromal period                : 3.0000
#>  - Quarantine period               : 14.0000
#>  - Quarantine willingness          : 0.9000
#>  - Rash period                     : 7.0000
#>  - Transmission rate               : 0.9000
#>  - Vaccination rate                : 0.9500
#>  - Vax efficacy                    : 0.9700
#> 
#> Distribution of the population at time 100:
#>   - ( 0) Susceptible             : 8999 -> 6919
#>   - ( 1) Exposed                 :    1 -> 299
#>   - ( 2) Prodromal               :    0 -> 83
#>   - ( 3) Rash                    :    0 -> 35
#>   - ( 4) Isolated                :    0 -> 0
#>   - ( 5) Isolated Recovered      :    0 -> 131
#>   - ( 6) Detected Hospitalized   :    0 -> 25
#>   - ( 7) Quarantined Exposed     :    0 -> 1
#>   - ( 8) Quarantined Susceptible :    0 -> 0
#>   - ( 9) Quarantined Prodromal   :    0 -> 0
#>   - (10) Quarantined Recovered   :    0 -> 0
#>   - (11) Hospitalized            :    0 -> 14
#>   - (12) Recovered               :    0 -> 1493
#> 
#> Transition Probabilities:
#>  - Susceptible              1.00  0.00     -     -     -     -     -     -  0.00     -     -     -     -
#>  - Exposed                     -  0.89  0.10     -     -     -     -  0.01     -  0.00     -     -     -
#>  - Prodromal                   -     -  0.66  0.33  0.00     -     -     -     -  0.00     -     -     -
#>  - Rash                        -     -     -  0.07  0.08  0.39  0.06     -     -     -     -  0.05  0.36
#>  - Isolated                    -     -     -     -  0.16  0.75  0.09     -     -     -     -     -     -
#>  - Isolated Recovered          -     -     -     -     -  0.89     -     -     -     -     -     -  0.11
#>  - Detected Hospitalized       -     -     -     -     -     -  0.91     -     -     -     -     -  0.09
#>  - Quarantined Exposed         -  0.03  0.00     -     -     -     -  0.87     -  0.09     -     -     -
#>  - Quarantined Susceptible  0.07     -     -     -     -     -     -     -  0.93     -     -     -     -
#>  - Quarantined Prodromal       -     -  0.01     -  0.38     -     -     -     -  0.61     -     -     -
#>  - Quarantined Recovered       -     -     -     -     -     -     -     -     -     -     -     -     -
#>  - Hospitalized                -     -     -     -     -     -     -     -     -     -     -  0.89  0.11
#>  - Recovered                   -     -     -     -     -     -     -     -     -     -     -     -  1.00
#>