Description Usage Arguments Value Author(s) Examples

View source: R/treeSimulatorCpp2.R

A tree is simulated based on a demographic process and user-supplied parameters and initial conditions. The times and types of samples must also be supplied.

1 2 | ```
## Default S3 method:
sim.co.tree(theta, demographic.process.model, x0, t0, sampleTimes, sampleStates = NULL, res = 1000, integrationMethod = "adams")
``` |

`theta` |
A named vector of parameter values required by the model. |

`demographic.process.model` |
An object of class demographic.process. See build.demographic.process. |

`x0` |
A named vector of initial conditions required by the model. This includes demes and any other dynamic variables. |

`t0` |
The time of origin of the process |

`sampleTimes ` |
A numeric vector providing the times of samples. If named, taxon labels will be based on names of the corresponding sample times. |

`sampleStates` |
For models with more than one deme, a matrix must be supplied describing the probability of sampling from each deme. Each row corresponds to a sample in the same order as sampleTimes. Each column corresponds to probability of sampling each deme. Column names should be defined which correspond to deme names in the model. Rows should sum to one. |

`res` |
Integer number of time steps to use when simulating model. |

`integrationMethod` |
If simulating an ODE model, this provides the integration routine corresponding to options in deSolve. |

An object of class DatedTree, which subclasses ape::phylo. The $heights attribute provides the time of each node in the tree. The $maxHeight attribute provides the time of the root.

Erik Volz

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
# A simple exponential growth model with birth rates beta and death rates gamma:
dm <- build.demographic.process(births=c( I = 'parms$beta * I' )
, deaths = c( I = 'parms$gamma * I' )
, parameterNames=c('beta', 'gamma')
, rcpp=FALSE
, sde=FALSE)
# simulate a tree based on the model:
tre <- sim.co.tree( list( beta = 1.5, gamma = 1 )
, dm
, x0 = c(I = 1 )
, t0 = 0
, sampleTimes = seq(10, 15, length.out=50)
, res = 1000
)
# plot the tree
plot( tre )
``` |

emvolz-phylodynamics/phydynR documentation built on May 28, 2018, 7:01 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.