Learn R Programming

epinet (version 0.0-7)

SEIR.simulator: Simulate an epidemic on a contact network

Description

Simulate the spread of an epidemic across an (undirected) contact network.

Usage

SEIR.simulator(M, N, beta, ki, thetai, ke=ki, thetae=thetai,
	latencydist="fixed", latencyperiod=0)

Arguments

M
an undirected network, given in edgelist matrix format
N
the number of nodes in the contact network.
beta
the transmission rate of the virus across an edge of the network.
ki
the shape parameter for the removal process for the epidemic.
thetai
the scale parameter for the removal process for the epidemic.
ke
the shape parameter for the removal process for the epidemic.
thetae
the scale parameter for the removal process for the epidemic.
latencydist
type of latency period; can be "fixed" or "gamma".
latencyperiod
length of latency period, if using latencydist == "fixed". Ignored if latencydist == "gamma". Set to 0 to get an SIR epidemic.

Value

  • matrix consisting of one row for each infection. Each row contains (in columns 1 - 5, respectively): the node infected, the infecting node, the time of infection, the time of transition from exposed to infective, and the time of removal. The times are shifted so that the first removal occurs at time 0.

Details

Takes as input an undirected network, given in edgelist matrix format, which is the same format returned by buildER. Randomly chooses an initial infective individual. The infection spreads randomly across edges in the network according to exponential infective periods with mean $\frac{1}{beta}$. An infective individual remains in the exposed state for a either a fixed period of time given by latencyperiod or a time described by a gamma RV with parameters ke and thetae (mean = $ke \cdot thetae$, var = $ke \cdot thetae^2$). After this exposed period, an infected person moves to the Infected state, at which point they can infect susceptible individuals. The infective individuals are removed after an infective period whose length is governed by a gamma RV with parameters ki and thetai (mean = $ki \cdot thetai$, var = $ki \cdot thetai^2$). Once an individual is removed, they cannot be re-infected and cannot infect others.

Examples

Run this code
# Simulate an epidemic through a network of 30
set.seed(1)
examplenet <- buildER(30,0.1)
exampleepidemic <- SEIR.simulator(examplenet,30,0.3,2,5,latencydist="gamma")

Run the code above in your browser using DataLab