Learn R Programming

PBD (version 1.0)

pbd_sim: Function to simulate the protracted speciation process

Description

Simulating the protracted speciation process using the Doob-Gillespie algorithm. This function differs from pbd_sim_cpp that 1) it does not require that the speciation-initiation rate is the same for good and incipient species, and 2) that it simulates the exact protracted speciation process, and not the approximation made by the coalescent point process.

Usage

pbd_sim(
   pars,
   age,
   soc = 2
)

Arguments

pars
Vector of parameters: pars[1] corresponds to b_1, the speciation-initiation rate of good species pars[2] corresponds to la_1, the speciation-completion rate pars[3] corresponds to b_2, the speciation-initiation r
age
Sets the age for the simulation
soc
Sets whether this age is the stem (1) or crown (2) age

Value

  • outA list with the following three elements: The first element is the tree of extant species in phylo format The second element is a tree with one sample per species in phylo format The third element is a matrix of all events in the simulation where - the first column is the incipient-level label of a species - the second column is the incipient-level label of the parent of the species - the third column is the time at which a species is born as incipient species - the fourth column is the time of speciation-completion of the species If the fourth element equals -1, then the species is still incipient. - the fifth column is the time of extinction of the species If the fifth element equals -1, then the species is still extant. - The sixth column is the species-level label of the species

See Also

pbd_sim_cpp

Examples

Run this code
pbd_sim(c(0.2,1,0.2,0.1,0.1),15)

Run the code above in your browser using DataLab