simuEpi: Simulate an epidemic following a SIR model

Description Usage Arguments Value Author(s) Examples

View source: R/simuEpi.R

Description

Simulate an epidemic following a SIR model, together with a transmission tree and a set of sequences consistent with the trajectory of the epidemic.

Usage

1
2
  simuEpi(N = 1000, D = 10, beta = 0.001, nu = 0.1, L = 1000, mu =
          0.001, plot=TRUE, makePhyloTree=FALSE)

Arguments

N

Size of the population

D

Duration of simulation

beta

Rate of infection

nu

Rate of recovery

L

Length of genetic sequences

mu

Probability of mutation per base per transmission event

plot

logical indicating whether or not to plot the SIR trajectory over time and save it in the output.

makePhyloTree

Logical; whether to create a neighbour-joining tree from the simulated sequences.

Value

A list containing the SIR dynamics ($dynamics), an obkData of the outbreak ($x), and an optional ggplot graphic ($plot).

Author(s)

Original version by Xavier Didelot and Caroline Colijn. Graphics modification by 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
## Not run: 
## Simulate an outbreak of 200 individuals over 20 time steps ##
set.seed(3)

x <- simuEpi(N = 200, D = 20, beta = 0.002, nu = 0.1, mu = 0.002)

## x is a list:
class(x)
names(x)

## x$dynamics contains demographic info
x$dynamics

## x$plot is a ggplot object
class(x$plot)
x$plot

## x$x is the obkData object
summary(x$x)
plotIndividualTimeline(x$x, colorBy="DateInfected")


## Same, with a phylogenetic tree
x <- simuEpi(N = 200, D = 20, beta = 0.002, nu = 0.1, mu = 0.002,
             plot=TRUE, makePhyloTree=TRUE)

plotggphy(x$x, ladderize=TRUE, show.tip=TRUE,
      branch.unit="year", tip.label.size=4)

## End(Not run)

OutbreakTools documentation built on Oct. 6, 2017, 1:03 a.m.