Learn R Programming

FossilSim (version 2.4.1)

sim.fossils.poisson: Simulate fossils under a Poisson sampling model

Description

Fossils can be simulated for a phylo (tree) or taxonomy (taxonomy) object. If both are specified, the function uses taxonomy. If no taxonomic information is provided, the function assumes all speciation is symmetric (i.e. bifurcating, beta = 1). A vector of rates can be specified to allow for rate variation across lineages. If a vector is provided, each entry will apply to each unique species in the order in which they appear in the taxonomy object (if taxonomy is provided), or to each unique edge in the order in which they appear in the tree object. If the tree object has a root edge (root.edge), the first entry in the rates vector should correspond to this edge.

Usage

sim.fossils.poisson(
  rate,
  tree = NULL,
  taxonomy = NULL,
  fossils = NULL,
  ignore.taxonomy = FALSE,
  root.edge = TRUE
)

Value

An object of class fossils.

Arguments

rate

A single Poisson sampling rate or a vector of rates.

tree

Phylo object.

taxonomy

Taxonomy object.

fossils

Append fossils to to an existing fossils object.

ignore.taxonomy

Ignore species taxonomy (returns sp = NA). Default = FALSE.

root.edge

If TRUE include the root edge. Default = TRUE.

See Also

sim.fossils.intervals, sim.fossils.environment, sim.trait.values

Examples

Run this code
# simulate tree
t = ape::rtree(6)

# simulate fossils using the tree
rate = 2
f = sim.fossils.poisson(rate, tree = t)
plot(f, t)

# simulate fossils using taxonomy
s = sim.taxonomy(t, 0.5, 1, 0.5)
f = sim.fossils.poisson(rate, taxonomy = s)
plot(f, t)

# simulate fossils with autocorrelated rate variation across lineages
rates = sim.trait.values(init = rate, taxonomy = s, v = 1)
f = sim.fossils.poisson(rates, taxonomy = s)
plot(f, t)

# append fossils to an existing fossils object
rate = 1
f1 = sim.fossils.poisson(rate, tree = t)
plot(f1, t)
rate = 2
f2 = sim.fossils.poisson(rate, tree = t, fossils = f1)
plot(f2, t)
f3 = sim.fossils.poisson(rate, tree = t, fossils = f2, ignore.taxonomy = TRUE)
plot(f3, t, show.unknown = TRUE)

Run the code above in your browser using DataLab