Learn R Programming

⚠️There's a newer version (2.4.1) of this package.Take me there.

FossilSim

R package for simulating fossil data on phylogenetic trees under mechanistic models of preservation and sampling

The latest version can be installed in R using the package devtools:

library(devtools)
install_github("fossilsim/fossilsim")

Quick start

Simulating data using FossilSim can be as simple as the following code snippets.

# simulate a tree using ape
tips = 8
t = ape::rtree(tips)
# simulate fossils using fossilsim
rate = 2
f = sim.fossils.poisson(rate, t)  
# plot the complete output
plot(f, t)
# plot the reconstructed output
plot(f, t, reconstructed = TRUE)
# simulate taxonomy using fossilsim
beta = 0.5 # probability of symmetric speciation
lambda.a = 0.1  # rate of anagenesis
s = sim.taxonomy(t, beta, lambda.a)  
# plot the output
plot(s, t, legend.position = "bottomright")

Package vignettes

The following vignettes are available via CRAN and provide detailed examples:

For further information and examples see the package documentation

Contributors

Joëlle Barido-Sottani
Walker Pett Joseph O'Reilly
Rachel Warnock

Citation

Joëlle Barido-Sottani et al. 2019. Methods Evolution & Ecology. FossilSim: an R package for simulating fossil occurrence data under mechanistic models of preservation and recovery

Copy Link

Version

Install

install.packages('FossilSim')

Monthly Downloads

366

Version

2.4.0

License

GPL-3

Maintainer

Joelle Barido-Sottani

Last Published

September 5th, 2024

Functions in FossilSim (2.4.0)

prune.fossil.tips

Remove fossil lineages from a tree
get_fbdrange_from_file

Import fbdrange object from file
rangeplot.asymmetric

Make an asymmetric stratigraphic range plot from a tree object of class phylo
plot.fossils

Plot simulated fossils
prune.fossils

Removes all intermediate fossils from a combined tree and labels the first and last fossils of each lineage. Can be used with sampled or complete trees. If only one fossil is present for a particular species it is labelled as first.
sim.fbd.rateshift.taxa

sim.fbd.rateshift.taxa: Simulating fossilized birth death trees incorporating rate shifts.
sampled.tree.from.combined

Removes all unsampled lineages from a combined tree. Extinct tips are only sampled if they are fossils. With default settings all extant tips are sampled.
sim.taxonomy

Simulate taxonomy
sim.anagenetic.species

Simulate anagenetic species on a taxonomy object
sim.tip.samples

Include extant and extinct tip samples in the fossil object, with optional rho sampling.
subsample.fossils.youngest

Obtain a subsample of fossil occurrences containing the youngest fossil sample in each node of the tree.
remove.stem.lineages

Remove stem lineages from a tree.
sim.fbd.age

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

Display taxonomy object
remove.stem.fossils

Remove fossil samples that occur in the stem
sim.trait.values

Simulate trait values with variation across lineages
species.end

Find a species' end (i.e extinction) time from a taxonomy object
subsample.fossils.oldest

Obtain a subsample of fossil occurrences containing the oldest fossil sample in each node of the tree.
species.start

Find a species' start (i.e speciation) time from a taxonomy object
sim.cryptic.species

Simulate cryptic species on a taxonomy object
place.fossils

Place fossil samples from one tree in another tree, or find the ancestral node for each fossil sample in one tree.
sim.fbd.taxa

sim.fbd.taxa: Simulating fossilized birth-death trees on a fixed number of extant taxa.
tree.max

Find the maximum age in a phylo object (root age or origin time)
taxonomy

Taxonomy object
sim.fossils.environment

Simulate fossils under an environment-dependent model of preservation (Holland, 1995)
sim.extant.samples

Include extant samples in the fossil object, with optional rho sampling.
reconcile.fossils.taxonomy

Reconcile existing fossil and taxonomy objects
sim.fossils.poisson

Simulate fossils under a Poisson sampling model
reconstructed.tree.fossils.objects

Returns tree and fossil objects that you can use to plot the reconstructed tree.
sim.fossils.intervals

Simulate fossils under a non-uniform model of preservation for a given set of consecutive time intervals
sim.gradient

Simulate an environmental gradient
sim.interval.ages

Reassign fossil ages to user-specified stratigraphic intervals
subsample.fossils.uniform

Obtain a uniform random sample of fossil occurrences.
subsample.fossils.oldest.and.youngest

Obtain a subsample of fossil occurrences containing the oldest and youngest fossil sample found at each node of the tree.
fossils

Fossils object
count.fossils

Count the total number of fossils
SAtree

Tree with sampled ancestors represented as zero-length edges
FossilSim

FossilSim: A package for simulating and plotting fossil and taxonomy data
fbdrange

Creates an fbdrange object from provided tree and data
fossils.to.BEAST.constraints

Create a set of BEAST2 constraints to construct a DPPDIV style fixed extant topology FBD analysis
fossils.to.BEAST.start.tree

Create a suitable starting tree for a DPPDIV style FBD analysis in BEAST2
plot.taxonomy

Plot simulated taxonomy
count.fossils.binned

Count the total number of fossils per interval
SAtree.from.fossils

Transforms a tree and fossils dataframe to a combined SA tree. Sampled ancestors are represented as tips on zero-length edges to maintain compatibility with the ape format. Tip labels are set to "species id"_"index", where the most recent tip of a given species receives index 1 and indices increase towards the past.
paleotree.record.to.fossils

Transforms a fossilRecordSimulation object from package paleotree to a tree and taxonomy and fossils objects.
get.tip.descs

Obtain the tips that define each node in a tree
plot.fbdrange

Plot oriented tree with stratigraphic ranges
beast.fbd.format

Transforms a tree and fossils into a sampled tree in beast-usable format and writes it in Newick format. Designed to work with FBD.
fossils.to.paleotree.record

Transforms a fossils dataframe and either taxonomy or tree into a fossilRecordSimulation object from package paleotree.
fossils.to.pyrate

Generate output in the format used by the program PyRate