| sim.epidemic {IDSpatialStats} | R Documentation |
Simulation of an epidemic in space and time
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
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 |
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 |
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
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)