Learn R Programming

expoTree (version 1.0.1)

sim.epi: Simulates epidemic outbreaks and sampled transmission trees.

Description

Simulate an instance of an epidemic outbreak along with a sampled transmission tree.

Usage

sim.epi(N,beta,mu,psi,max.samples,min.outbreak=min(10,max.samples),max.time=-1.0)

Arguments

N
Population size (carrying capacity). Set N=0 for density-independent transmission.
beta
Transmission rate.
mu
Death rate.
psi
Sampling rate.
max.samples
Simulate epidemic until this many individuals are sampled. Set to zero for species phylogenies (see Details).
min.outbreak
Minimum number of infecteds that is considered an outbreak (avoids stochastic extinctions).
max.time
Maximum time to run epidemic, even if max.samples isn't reached.

Value

List with the following entries:- times : event times of the sampled transmission tree. - ttypes : event types of the sampled transmission tree (0 = sampling, 1 = branching). - itimes : infection times of all (sampled and unsampled) individuals. - dtimes : removal times of all individuals. - dtypes : type of removal (0 = sampling, -1 = death, 1 = still infected at the present) - id : identifier of the individual - parent : identifier of the infector of an individual (can be used to recreate the transmission history)

Details

Fixed-time sampling. The default behavior is to simulate sampled phylogenies for sequentially sampled data. It is possible to simulate fixed time sampling by setting psi=0. In this case the simulation is run until the total number of infecteds is equal to max.samples, when the simulation is stopped and all lineages are sampled.

References

Leventhal, Bonhoeffer & Stadler, 2012

See Also

expoTree

Examples

Run this code
  N <- 100
  beta <- 1
  mu <- 0.1
  psi <- 0.4
  nsamp <- 100
  epi <- sim.epi(N,beta,mu,psi,nsamp)

Run the code above in your browser using DataLab