Learn R Programming

phylolm (version 2.1)

rTrait: Continuous trait simulation

Description

Simulates a continuous trait along a tree from various phylogenetic models.

Usage

rTrait(n=1, phy, model=c("BM","OU","lambda","kappa","delta","EB","trend"),
       parameters = NULL, plot.tree=FALSE)

Arguments

n
number of independent replicates
phy
a phylogenetic tree of type phylo with branch lengths.
model
a phylogenetic model. Default is "BM", for Brownian motion. Alternatives are "OU", "lambda", "kappa", "delta", "EB" and "trend".
parameters
List of parameters for the model (see Note).
plot.tree
If TRUE, the tree with transformed branch lengths will be shown, except for the OU model.

Value

  • If n=1, a numeric vector with names from the tip labels in the tree. For more than 1 replicate, a matrix with the tip labels as row names, and one column per replicate.

encoding

utf-8

Details

Possible phylogenetic models are the Brownian motion model (BM), the Ornstein-Uhlenbeck model (OU), Pagel's $\lambda$ model (lambda), Pagel's $\kappa$ model (kappa), Pagel's $\delta$ model (delta), the early burst model (EB), and the Brownian motion model with a trend (trend).

See Also

rTraitCont.

Examples

Run this code
tre = rtree(50)
y = rTrait(n=1, phy=tre, model="OU",
           parameters=list(optimal.value=2,sigma2=1,alpha=0.1))

Run the code above in your browser using DataLab