Description Usage Arguments Value Author(s) Examples
The function simOutbreak
implements simulations of disease outbreaks.
The infectivity of cases is defined by a generation time distribution. The
function as.igraph
allows to convert simulated transmission trees
into igraph
objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | simOutbreak(R0, infec.curve, n.hosts = 200, duration = 50,
seq.length = 10000, mu.transi = 1e-04, mu.transv = mu.transi/2,
rate.import.case = 0.01, diverg.import = 10, group.freq = 1,
spatial = FALSE, disp = 0.1, area.size = 10, reach = 1,
plot = spatial, stop.once.cleared = TRUE)
## S3 method for class 'simOutbreak'
print(x, ...)
## S3 method for class 'simOutbreak'
x[i, j, drop = FALSE]
## S3 method for class 'simOutbreak'
labels(object, ...)
## S3 method for class 'simOutbreak'
as.igraph(x, edge.col = "black", col.edge.by = "dist",
vertex.col = "gold", edge.col.pal = NULL, annot = c("dist", "n.gen"),
sep = "/", ...)
## S3 method for class 'simOutbreak'
plot(x, y = NULL, edge.col = "black",
col.edge.by = "dist", vertex.col = "gold", edge.col.pal = NULL,
annot = c("dist", "n.gen"), sep = "/", ...)
|
R0 |
the basic reproduction number; to use several groups, provide a vector with several values. |
infec.curve |
a |
n.hosts |
the number of susceptible hosts at the begining of the outbreak |
duration |
the number of time steps for which simulation is run |
seq.length |
an integer indicating the length of the simulated haplotypes, in number of nucleotides. |
mu.transi |
the rate of transitions, in number of mutation per site and per time unit. |
mu.transv |
the rate of transversions, in number of mutation per site and per time unit. |
rate.import.case |
the rate at which cases are imported at each time step. |
diverg.import |
the number of time steps to the MRCA of all imported cases. |
group.freq |
the frequency of the different groups; to use several groups, provide a vector with several values. |
spatial |
a logical indicating if a spatial model should be used. |
disp |
the magnitude of dispersal (standard deviation of a normal distribution). |
area.size |
the size of the square area to be used for spatial simulations. |
reach |
the mean of the exponential kernel used to determine new infections. |
plot |
a logical indicating whether an animated plot of the outbreak should be displayed; only available with the spatial model. |
stop.once.cleared |
a logical indicating if the simulation should stop when the global force of infection is close to zero (<10^-12); TRUE by default. |
x, object |
|
... |
further arguments to be passed to other methods |
i, j, drop |
|
edge.col |
the color of the edges of the plotted graph; overridden by
|
col.edge.by |
a character indicating the type of information to be used to color the edges; currently, the only valid value is "dist" (distances, in number of mutations). Other values are ignored. |
vertex.col |
the colors to be used for the vertices (i.e., cases). |
edge.col.pal |
the color palette to be used for the edges; if NULL, a grey scale is used, with darker shades representing larger values. |
annot |
a character indicating the information to be used to annotate the edges; currently accepted values are "dist" (genetic distances, in number of mutations), and "n.gen" (number of generations between cases). |
sep |
a character used to separate fields used to annotate the edges, whenever more than one type of information is used for annotation. |
y |
present for compatibility with the generic 'plot' method. Currently not used. |
col |
the color of the vertices of the plotted graph. |
=== simOutbreak class ===
simOutbreak
objects are lists
containing the following slots:
n: the number of cases in
the outbreak
dna: DNA sequences in the DNAbin matrix format
dates: infection dates
dynam: a data.frame containing, for
each time step (row), the number of susceptible, infected, or recovered in
the population.
id: a vector of integers identifying the cases
ances: a vector of integers identifying infectors ('ancestor')
nmut: the number of mutations corresponding to each ancestry
ngen: the number of generations corresponding to each ancestry
call: the matched call
Implementation by Thibaut Jombart t.jombart@imperial.ac.uk.
Epidemiological model designed by Anne Cori and Thibaut Jombart.
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 30 31 32 33 34 35 | ## Not run:
dat <- list(n=0)
## simulate data with at least 30 cases
while(dat$n < 30){
dat <- simOutbreak(R0 = 2, infec.curve = c(0, 1, 1, 1), n.hosts = 100)
}
dat
## plot first 30 cases
N <- dat$n
plot(dat[1:(min(N,30))], main="First 30 cases")
mtext(side=3, text="nb mutations / nb generations")
## plot a random subset (n=10) of the first cases
x <- dat[sample(1:min(N,30), 10, replace=FALSE)]
plot(x, main="Random sample of 10 of the first 30 cases")
mtext(side=3, text="nb mutations / nb generations")
## plot population dynamics
head(dat$dynam,15)
matplot(dat$dynam[1:max(dat$onset),],xlab="time",
ylab="nb of individuals", pch=c("S","I","R"), type="b")
## spatial model
w <- exp(-sqrt((1:40)))
x <- simOutbreak(2, w, spatial=TRUE,
duration=500, disp=0.1, reach=.2)
## spatial model, no dispersal
x <- simOutbreak(.5, w, spatial=TRUE,
duration=500, disp=0, reach=5)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.