Simulate trees with fixed number of sampled taxa and trait prevalance

Share:

Description

This function generates a tree that contains a defined number of sampled taxa for each of the two trait states.

Usage

1
treesim(pars, N0, N1, sampling.f, max.t = Inf)

Arguments

pars

a vector of parameters that describe the macroevolutionary processes of the tree. Parameters are in order of speciation rate for trait state 0, speciation rate for trait state 1, extinction rate for trait state 0, extinction rate for trait state 1, transition rate from state 0 to state 1, transition rate from state 1 to state 0.

N0

the number of sampled taxa with trait state 0.

N1

the number of sampled taxa with trait state 1.

sampling.f

a vector of sampling fraction of taxa with trait state 0 and trait state 1.

max.t

the maximum amount of time, above which tree simulation stops and reports the tree as not being able to coalesce.

Examples

1
phy <- treesim(pars=c(0.1,0.1,0.05,0.05,0.1,0.1),N0=50,N1=50,sampling.f=c(1,1),max.t=Inf)