Skip to contents

Distribution functions control how a virus is initially assigned across agents in a model.

Usage

set_distribution_virus(virus, distfun)

distribute_virus_randomly(prevalence, as_proportion, agents_ids = integer(0))

distribute_virus_to_set(agents_ids)

distribute_virus_set(agents_ids)

distribute_virus_to_entities(prevalence, as_proportion)

Arguments

virus

An object of class epiworld_virus.

distfun

An object of class epiworld_virus_distfun.

prevalence

Numeric scalar. Prevalence of the virus. In the case of distribute_virus_to_entities(), it is a vector of prevalences, one per entity.

as_proportion

Logical scalar. If TRUE, prevalence is interpreted as a proportion of the total number of agents in the model.

agents_ids

Integer vector. Indices of the agents that will receive the virus.

Value

  • set_distribution_virus() does not return a value. It assigns a distribution function to the specified virus.

  • distribute_virus_randomly() returns a distribution function of class epiworld_virus_distfun. When agents_ids is not empty, it distributes the virus randomly within that set. Otherwise it uses all agents in the model.

  • distribute_virus_to_set() returns a distribution function of class epiworld_virus_distfun.

  • distribute_virus_set() is a deprecated alias for distribute_virus_to_set().

  • distribute_virus_to_entities() returns a distribution function of class epiworld_virus_distfun.

Details

set_distribution_virus() assigns a distribution function to the specified virus of class epiworld_virus. Distribution functions can be created with distribute_virus_randomly(), distribute_virus_to_set(), and distribute_virus_to_entities().

distribute_virus_randomly() creates a distribution function that randomly assigns the virus to a proportion of the population.

distribute_virus_to_set() creates a distribution function that assigns the virus to a fixed set of agents.

distribute_virus_to_entities() creates a distribution function that assigns the virus to a number of agents based on entity-level prevalence. This is only useful for the mixing models.

Examples

model <- ModelSEIRCONN(
  name              = "COVID-19",
  prevalence        = 0.01,
  n                 = 10000,
  contact_rate      = 4,
  incubation_days   = 7,
  transmission_rate = 0.5,
  recovery_rate     = 0.99
)

delta <- virus(
  "Delta Variant", 0.3, TRUE, .5, .2, .01
)

set_distribution_virus(
  delta,
  distribute_virus_randomly(100, as_proportion = FALSE)
)

add_virus(model, delta)

set_distribution_virus(
  delta,
  distribute_virus_to_set(1:10)
)