SEIR.simulator: Simulate an epidemic on a contact network

View source: R/SEIR.simulator.R

SEIR.simulatorR Documentation

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.

Details

Takes as input an undirected network, given in edgelist matrix format, which is the same format returned by SimulateDyadicLinearERGM. 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.

Value

matrix consisting of one row for each individual in the population. 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. The rows corresponding to the susceptible members of the population (i.e., the individuals that were not infected during the course of the epidemic) are placed after those for the infected individuals.

Author(s)

Chris Groendyke cgroendyke@gmail.com, David Welch david.welch@auckland.ac.nz,

See Also

SimulateDyadicLinearERGM for simulating an Erdos-Renyi contact network, epinet for performing inference on the network and epidemic model parameters, and plot.epidemic and epi2newick for plotting functions.

Examples

# Simulate an epidemic through a network of 30
set.seed(3)
N <- 30
# Build dyadic covariate matrix (X)
# Have a single covariate for overall edge density; this is the Erdos-Renyi model
nodecov <- matrix(1:N,nrow = N)
dcm <- BuildX(nodecov)
# Simulate network and then simulate epidemic over network
examplenet <- SimulateDyadicLinearERGM(N, dyadiccovmat = dcm, eta = -1.8)
exampleepidemic <- SEIR.simulator(examplenet, N = 30, 
    beta = 0.3, ki = 2, thetai = 5, latencydist = "gamma")

epinet documentation built on May 29, 2024, 3:11 a.m.