# sim.bd.taxa: sim.bd.taxa: Simulating birth-death trees on a fixed number... In TreeSim: Simulating Phylogenetic Trees

## Description

sim.bd.taxa simulates trees on n species under the constant rate birth-death process. The method allows for incomplete sampling, i.e. (i) only a fixed fraction of all extant tips is included in the sampled tree or (ii) each extant tip from a complete tree is included with a fixed probability. In both cases, the tree is conditioned to have n tips after sampling. If you want to relax the assumption of constant rates, this function will not work. If you want to change rates through time use sim.rateshift.taxa. If you want to have species-age dependent rates, use sim.taxa in R package TreeSimGM.

## Usage

 ```1 2``` ```sim.bd.taxa(n, numbsim, lambda, mu, frac = 1, complete = TRUE, stochsampling = FALSE) ```

## Arguments

 `n` Number of extant sampled tips. `numbsim` Number of trees to simulate. `lambda` Speciation rate. `mu` Extinction rate. `frac` When complete = FALSE and stochsampling=FALSE: The actual number of tips is n/frac, but only n tips are included (incomplete sampling). When complete = FALSE and stochsampling=TRUE: Each tip is included into the final tree with probability frac. When complete = TRUE: all extinct and non-sampled lineages are included, i.e. the tree has n/frac extant tips. `complete` If TRUE, the tree with the extinct and non-sampled lineages is returned. If FALSE, the extinct lineages are suppressed. `stochsampling` See frac.

## Value

 `out` List of numbsim simulated trees with n extant sampled tips.

## Note

For stochsampling = TRUE: The algorithm is fast for the critical process, lambda=mu.

## References

T. Stadler. Simulating trees on a fixed number of extant species. Syst. Biol., 60: 676-684, 2011.

T. Stadler. On incomplete sampling under birth-death models and connections to the sampling-based coalescent. Jour. Theo. Biol. 261: 58-66, 2009.

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```n<-10 lambda <- 2.0 mu <- 0.5 frac <-0.6 numbsim<-2 ## # Simulating numbsim trees with n species under a birth-death process with # speciation rate lambda an extinction rate mu: sim.bd.taxa(n,numbsim,lambda,mu) # Each extant species is included in final tree with probability frac # (the tree has n species AFTER sampling): sim.bd.taxa(n,numbsim,lambda,mu,frac,complete=FALSE,stochsampling=TRUE) # A fraction frac of the extant species is included into the final tree # (the tree has n species AFTER sampling): sim.bd.taxa(n,numbsim,lambda,mu,frac,complete=FALSE,stochsampling=FALSE) ```