Learn R Programming

hisse (version 1.3)

SimToPhylo: Convert simulated result to a tree

Description

Converts the $results element of the return to a phylo object

Usage

SimToPhylo(results, include.extinct=FALSE, drop.stem=TRUE)

Arguments

results
dataframe of results from SimulateHisse.
include.extinct
include (TRUE) or delete (FALSE) extinct terminal taxa.
drop.stem
include the lineage leading to the first saved speciation even (FALSE) or cull it (TRUE).

Value

  • phyloa phylo object in cladewise order.

Details

This takes the $results object from a SimulateHisse run and converts it to an ape phylo object. If there are no taxa on the final tree, it returns NA; if there is one taxon, it returns a one taxon tree. This is behavior different from diversitree's tree simulators, which returns NULL in both the zero and one taxon case. Extinct taxa can be pruned or not. For simulations starting with one taxon, and/or for simulations with some extinction, the final tree can have a time when there is a single lineage before it radiates into the crown group. This stem can be included or not. The tip states are stored in $tip.state in the returned tree.

References

Beaulieu, J.M, and B.C. O'Meara. In revision. Detecting hidden diversification shifts in models of trait-dependent speciation and extinction. Syst. Biol. In revision.

Examples

Run this code
simulated.result <- SimulateHisse(c(.3, .1), c(.1, 0), 
matrix(c(NA, 0.2, .3, NA), nrow=2), max.taxa=35, x0=1)	
par(mfcol=c(1,2))
plot(SimToPhylo(simulated.result$results, include.extinct=TRUE))
plot(SimToPhylo(simulated.result$results, include.extinct=FALSE))

Run the code above in your browser using DataLab