sim.epidemic: Simulation of an epidemic in space and time

Description Usage Arguments Value Author(s) Examples

View source: R/transdistfuncs.r

Description

A function which simulates the spatial spread of infections through time given the reproductive number (R), a function describing the spatial transmission kernel (trans.kern.func), and the mean and standard deviation of the generation time distribution (gen.t.mean and gen.t.sd) for the infecting pathogen. The function returns the location (x, y) and time (t) for each case of infection in the simulation.

Usage

1
2
sim.epidemic(R, gen.t.mean, gen.t.sd, trans.kern.func,
  tot.generations = 10, min.cases = 0, max.try = 1000)

Arguments

R

a scalar or a vector of length tot.generations providing the reproductive number for the epidemic. If scalar, the R value is constant. If a vector, the R value varies according to each generation in the vector.

gen.t.mean

mean of generation time

gen.t.sd

standard deviation of the generation time (assumed to be normally distributed)

trans.kern.func

a function for the transmission kernel that takes n as an arguement. Function and associated parameters must be given in a list object.

tot.generations

the total number of generations in the epidemic, where the index case (x,y,t = [0,0,0]) is considered generation zero (default = 10)

min.cases

the minimum number of cases in the epidemic (default = 0)

max.try

maximum number of tries to acheive the minimum number of cases (default = 1000)

Value

a numerical matrix with three columns giving the coordinates x and y, and time t of simulated cases

Author(s)

John Giles, Justin Lessler, and Henrik Salje

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
     
set.seed(1)

dist.func <- alist(n=1, a=1/100, rexp(n, a)) # Exponential transmission kernel with mean = sd = 100

# Simulate epidemic with constant R value
a <- sim.epidemic(R=1.5,
             gen.t.mean=7,
             gen.t.sd=2,
             tot.generations=15,
             min.cases=100,
             trans.kern.func=dist.func)

sim.plot(a)

# Simulate an epidemic with variable R value
r1 <- 2
r2 <- 0.25
tg <- 25
R <- seq(r1, r2, (r2 -r1)/(tg - 1))

b <- sim.epidemic(R=R,
             gen.t.mean=7,
             gen.t.sd=2,
             tot.generations=tg,
             min.cases=100,
             trans.kern.func=dist.func)

sim.plot(b)

IDSpatialStats documentation built on Nov. 16, 2019, 1:08 a.m.