simOutbreak: Simulation of pathogen genotypes during disease outbreaks

Description Usage Arguments Value Author(s) Examples

Description

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.

Usage

 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 = "/", ...)

Arguments

R0

the basic reproduction number; to use several groups, provide a vector with several values.

infec.curve

a numeric vector describing the individual infectiousness at time t=0, 1, ...

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

simOutbreak objects.

...

further arguments to be passed to other methods

i, j, drop

i is a vector used for subsetting the object. For instance, i=1:3 will retain only the first three haplotypes of the outbreak. j and drop are only provided for compatibility, but not used.

edge.col

the color of the edges of the plotted graph; overridden by col.edge.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.

Value

=== simOutbreak class ===
simOutbreak objects are lists containing the following slots:

Author(s)

Implementation by Thibaut Jombart t.jombart@imperial.ac.uk.

Epidemiological model designed by Anne Cori and Thibaut Jombart.

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
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)

outbreaker documentation built on May 1, 2019, 10:23 p.m.