GSE_sim: An epidemic simulation

Description Usage Arguments Details Value Examples

View source: R/GSE_sim.R

Description

This function allows you to simulate a stochastic SIR epidemic, with a heterogeneous contact matrix.

Usage

1
GSE_sim(N, beta.mat, gamma)

Arguments

N

The size of the population.

beta.mat

An NxN matrix of the pair wise infection rates between all individuals.

gamma

The removal rate.

Details

The infectious life history of each individual is comprised of two parts;

The distributions of which are given by;

The simulation begins with an initial infective infectious at time 0.

I_i is the time at which individual i becomes infected, and their removal time is given by R_i = I_i + Q_i.

If W_{i,j} < Q_i, then individual i makes infectious contact with individual j at time I_i + W_{i,j}.

If individual j is susceptible when this happens, then they become infected, otherwise nothing happens. The simulation assumes that W_{i,j} != W_{j,i}.

The simulation continues until there are no infected individuals left in the population.

Value

The function returns a matrix containing 4 columns; the id number of each individual, their infection time (NA if not infected), their removal time (NA if not infected), and their generated infectious period length.

Examples

1
2
3
4
5
6
7
8
# Generate a distance matrix
   distance_mat <- Dist_mat_unif(N=100, xlim = 20, ylim = 20)[[2]]

# Generate an associated infection rate rate matrix
   rate_mat <- Beta_mat_form(distance_mat, c(0.004, 0.002), 10)
   
# Generate a simulated epidemic
   Hetero_sim <- GSE_sim(N = 100, beta.mat = rate_mat, gamma = 0.15)

BenjamenSimon/EpidemicR documentation built on March 23, 2020, 11:03 p.m.