Skip to contents

Draws the topology with rtopology_beta() and the internode intervals with intervals_lineage_rate(), and combines them with assign_ages(). The topology and the intervals are drawn independently, the gamma statistic depends only on the intervals and the Colless index only on the topology, so for a given n the realized gamma depends only on c and the realized Colless index only on beta. To draw trees near target values of both statistics, see sim_tree_target().

Usage

sim_tree_shape(n, beta = 0, c = 0, nsim = 1, root_age = 1)

Arguments

n

Number of tips, a single integer of at least 2.

beta

Aldous' beta, a single finite number greater than -2. Lower values give more imbalanced trees.

c

Lineage dependence of the split rate, a single finite number.

nsim

Number of trees.

root_age

Age of the root (positive).

Value

With nsim = 1, a binary, ultrametric phylo object with root depth root_age; otherwise a multiPhylo object with nsim such trees.

Reproducibility

The same seed gives the same trees on the same platform. Between platforms (for instance, arm64 and x86-64), differences in the last bit of floating-point functions can change a few draws of the topology, so trees may differ.

Examples

set.seed(1)
tr <- sim_tree_shape(50, beta = -1, c = -1)
ape::gammaStat(tr)
#> [1] -4.320064
trees <- sim_tree_shape(50, beta = -1, c = -1, nsim = 10, root_age = 30)