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(
  vname,
  n,
  prevalence,
  contact_rate,
  transmission_rate,
  vax_efficacy,
  vax_reduction_recovery_rate,
  incubation_period,
  prodromal_period,
  rash_period,
  contact_matrix,
  hospitalization_rate,
  hospitalization_period,
  days_undetected,
  quarantine_period,
  quarantine_willingness,
  isolation_willingness,
  isolation_period,
  prop_vaccinated,
  contact_tracing_success_rate = 1,
  contact_tracing_days_prior = 4
)

Arguments

vname

String. Name of the virus

n

Number of individuals in the population.

prevalence

Double. Initial proportion of individuals with the virus.

contact_rate

Numeric scalar. Average number of contacts per step.

transmission_rate

Numeric scalar between 0 and 1. Probability of transmission.

vax_efficacy

Double. Vaccine efficacy rate.

vax_reduction_recovery_rate

Double. Vaccine reduction in recovery rate.

incubation_period

Double. Duration of incubation period.

prodromal_period

Double. Duration of prodromal period.

rash_period

Double. Duration of rash period.

contact_matrix

Matrix of contact rates between individuals.

hospitalization_rate

Double. Rate of hospitalization.

hospitalization_period

Double. Period of hospitalization.

days_undetected

Double. Number of days an infection goes undetected.

quarantine_period

Integer. Number of days for quarantine.

quarantine_willingness

Double. Proportion of agents willing to quarantine.

isolation_willingness

Double. Proportion of agents willing to isolate.

isolation_period

Integer. Number of days for isolation.

prop_vaccinated

Double. Proportion of population that is vaccinated.

contact_tracing_success_rate

Double. Probability of successful contact tracing.

contact_tracing_days_prior

Integer. Number of days prior to the onset of the infection for which contact tracing is effective.

Value

  • The ModelMeaslesMixing function returns a model of class epiworld_model.

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.

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(
  vname                    = "Measles",
  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...
#> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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  : 120.00ms
#> Last run speed      : 7.45 million agents x day / second
#> Rewiring            : off
#> 
#> Global events:
#>  - Update infected individuals (runs daily)
#> 
#> Virus(es):
#>  - Measles
#> 
#> Tool(s):
#>  - Vaccine
#> 
#> Model parameters:
#>  - 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
#>  - Vax improved recovery        : 0.8000
#> 
#> Distribution of the population at time 100:
#>   - ( 0) Susceptible             : 8999 -> 7172
#>   - ( 1) Exposed                 :    1 -> 405
#>   - ( 2) Prodromal               :    0 -> 130
#>   - ( 3) Rash                    :    0 -> 45
#>   - ( 4) Isolated                :    0 -> 5
#>   - ( 5) Isolated Recovered      :    0 -> 159
#>   - ( 6) Detected Hospitalized   :    0 -> 15
#>   - ( 7) Quarantined Exposed     :    0 -> 0
#>   - ( 8) Quarantined Susceptible :    0 -> 1
#>   - ( 9) Quarantined Prodromal   :    0 -> 0
#>   - (10) Quarantined Recovered   :    0 -> 0
#>   - (11) Hospitalized            :    0 -> 17
#>   - (12) Recovered               :    0 -> 1051
#> 
#> Transition Probabilities:
#>  - Susceptible              1.00  0.00     -     -     -     -     -     -  0.00     -     -     -     -
#>  - Exposed                     -  0.90  0.10     -     -     -     -  0.00     -  0.00     -     -     -
#>  - Prodromal                   -     -  0.68  0.32     -     -     -     -     -     -     -     -     -
#>  - Rash                        -     -     -  0.06  0.08  0.37  0.06     -     -     -     -  0.06  0.38
#>  - Isolated                    -     -     -     -  0.15  0.76  0.09     -     -     -     -     -     -
#>  - Isolated Recovered          -     -     -     -     -  0.90     -     -     -     -     -     -  0.10
#>  - Detected Hospitalized       -     -     -     -     -     -  0.89     -     -     -     -     -  0.11
#>  - Quarantined Exposed         -  0.02  0.01     -     -     -     -  0.85     -  0.12     -     -     -
#>  - Quarantined Susceptible  0.07     -     -     -     -     -     -     -  0.93     -     -     -     -
#>  - Quarantined Prodromal       -     -  0.04     -  0.46     -     -     -     -  0.50     -     -     -
#>  - Quarantined Recovered       -     -     -     -     -     -     -     -     -     -     -     -     -
#>  - Hospitalized                -     -     -     -     -     -     -     -     -     -     -  0.91  0.09
#>  - Recovered                   -     -     -     -     -     -     -     -     -     -     -     -  1.00
#>