sim.fbd.age: sim.fbd.age: Simulating fossilized birth-death trees of a...

View source: R/sim.fbd.R

sim.fbd.ageR Documentation

sim.fbd.age: Simulating fossilized birth-death trees of a fixed age.

Description

sim.fbd.age: Simulating fossilized birth-death trees of a fixed age.

Usage

sim.fbd.age(
  age,
  numbsim,
  lambda,
  mu,
  psi,
  frac = 1,
  mrca = FALSE,
  complete = FALSE,
  K = 0
)

Arguments

age

Time since origin / most recent common ancestor.

numbsim

Number of trees to simulate.

lambda

Speciation rate.

mu

Extinction rate.

psi

Fossil sampling rate.

frac

Extant sampling fraction: The actual (simulated) number of tips is n, but only n*frac tips are included in the sampled tree (incomplete sampling).

mrca

If mrca=FALSE: age is the time since origin. If mrca=TRUE: age is the time since the most recent common ancestor of all sampled tips.

complete

whether to return the complete tree (with non-sampled lineages) or the reconstructed tree (with unsampled lineages removed).

K

If K = 0 (default), then lambda is constant. If K>0, density-dependent speciation is assumed, with speciation rate = lambda(1-m/K) when there are m living species.

Value

Array of 'numbsim' SAtrees with the time since origin / most recent common ancestor being 'age'. If the tree goes extinct or no tips are sampled (only possible when mrca = FALSE), return value is '0'. If only one extant and no extinct tips are sampled, return value is '1'.

Examples

age = 1
lambda = 2.0
mu = 0.5
psi = 0.6
numbsim = 2
if (requireNamespace("TreeSim", quietly = TRUE)) {
sim.fbd.age(age, numbsim, lambda, mu, psi)
}

FossilSim documentation built on Oct. 5, 2023, 5:08 p.m.