Description Usage Arguments Value Author(s) Examples
Simulate an epidemic following a SIR model, together with a transmission tree and a set of sequences consistent with the trajectory of the epidemic.
1 2 |
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. |
A list containing the SIR dynamics ($dynamics
), an
obkData
of the outbreak ($x
), and an optional ggplot
graphic ($plot
).
Original version by Xavier Didelot and Caroline Colijn. Graphics modification by 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 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.