View source: R/transdistfuncs.r
| sim.epidemic | R Documentation |
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.
sim.epidemic(
R,
gen.t.mean,
gen.t.sd,
trans.kern.func,
tot.generations = 10,
min.cases = 0,
max.try = 1000
)
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) |
a numerical matrix with three columns giving the coordinates x and y, and time t of simulated cases
John Giles, Justin Lessler, and Henrik Salje
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.