fastBM: (Reasonably) fast quantitative trait simulation on...

View source: R/fastBM.R

fastBMR Documentation

(Reasonably) fast quantitative trait simulation on phylogenies

Description

Simulates one or multiple continuous traits on the tree under various evolutionary models.

Usage

fastBM(tree, a=0, mu=0, sig2=1, bounds=c(-Inf,Inf), internal=FALSE, nsim=1, 
   ...)

Arguments

tree

is a phylogenetic tree in "phylo" format.

a

a value for ancestral state at the root node.

mu

an optional value for the mean of random normal changes along branches of the tree - can be used to simulate a trend if mu!=0.

sig2

instantaneous variance of the BM process, \sigma^2.

bounds

a vector with the lower and upper bounds (respectively) for bounded Brownian simulation - by default simulation is unbounded.

internal

logical value indicating whether or not to return states for internal nodes.

nsim

number of simulations.

...

optional arguments alpha and theta used for OU simulation. If alpha is set then mu and bounds are ignored with a warning.

Details

This function conducts (reasonably) fast quantitative trait simulation on a phylogeny under several different models: Brownian motion (default), BM with a trend (for mu!=0), bounds (for bounds!=c(-Inf, Inf)), and OU.

Value

A vector (for nsim=1) or matrix containing the tip states for the n species in the tree, and (optionally) the ancestral states for internal nodes.

Author(s)

Liam Revell liam.revell@umb.edu

References

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

See Also

sim.corrs

Examples

## simulate 10 characters on the Anolis tree 
## under Brownian motion
data(anoletree)
X<-fastBM(anoletree,nsim=10)
head(X)

liamrevell/phytools documentation built on March 4, 2024, 3:27 a.m.