Learn R Programming

phylocurve (version 2.1.1)

sim.traits: Simulate multivariate trait evolution

Description

This function wraps the sim.char in geiger function to simulate evolutionary models under a given evolutionary rate matrix, with the option of simulating multiple within-species observations and missing data.

Usage

sim.traits(ntaxa = 15, ntraits = 4, nreps = 1,
nmissing = 0, tree, v, anc, intraspecific,
model = "BM", parameters, nsim = 1, return.type = "matrix")

Arguments

ntaxa

Number of species to randomly generate on a pure-birth phylogeny (used if tree is not provided).

ntraits

Number of traits to randomly simulate according to a random evolutionary rate matrix (used if v is not provided).

nreps

Number of within-species observations to simulate (default is 1).

nmissing

Number of observations to randomly remove from the simulated data (default is 0).

tree

Optional: an object of class phylo (if none provided, a random pure-birth phylogeny of size ntraxa is generated).

v

The evolutionary covariance matrix. If none provided, a random covariance matrix of size ntraits-by-ntraits is generated.

anc

An optional vector of ancestral values.

intraspecific

An optional vector of within-species variance.

model

The evolutionary model to simulate trait evolution (BM, OUrandomRoot, OUfixedRoot, EB, lambda, kappa, or delta).

parameters

The evolutionary model parameter in a named list. Example: list(lambda = 0.5)

nsim

Number of datasets to simulate.

return.type

"data.frame" or "matrix"

Value

trait_data

Simulated trait data

tree

The phylogenetic tree

sim_tree

The phylogenetic tree with specified branch length transformations

References

Harmon Luke J, Jason T Weir, Chad D Brock, Richard E Glor, and Wendell Challenger. 2008. GEIGER: investigating evolutionary radiations. Bioinformatics 24:129-131.

See Also

sim.char