sim.evorates: Simulate rate/trait data under an evorates model

View source: R/SIM_generation.R

sim.evoratesR Documentation

Simulate rate/trait data under an evorates model

Description

This function simulates branchwise rates and corresponding trait data on a given phylogeny under an "evorates"-style model potentially including rate variance ("R_sig2"), a trend ("R_mu"), and/or tip error ("Y_sig2"). Capable of simulating multivariate trait evolution, but this feature is not well-tested.

Usage

sim.evorates(
  tree,
  R0 = 0,
  Rsig2 = 1,
  X0 = 0,
  Rmu = 0,
  Xsig2 = 1,
  trait.names = NULL,
  n.obs = rep(1, length(tree$tip.label)),
  Ysig2 = 0,
  percent = FALSE,
  anc.states = FALSE,
  slow = FALSE,
  res = 500
)

Arguments

tree

An object of class "phylo".

R0

The natural log of the starting rate at the root of the phylogeny.

Rsig2

The rate variance parameter, which controls the magnitude of random changes in rates over time.

X0

The starting trait value(s) at the root of the phylogeny. Recycled if Xsig2 and/or Ysig2 imply more traits.

Rmu

The trend parameter, which controls whether rates tend to decrease or increase over time.

Xsig2

The "base" rate of trait evolution, which scales both R0 and simulated branchwise rates. You should generally leave this alone unless you want to simulate multivariate trait evolution, in which case this should be a vector or "rate matrix" describing evolutionary rates and covariances via its diagonal and off-diagonal elements, respectively. Vectors are coerced diagonal matrices with 0 off-diagonal entries (i.e., no evolutionary correlations). After simulation, Xsig2 is normalized to have mean rate of 1, and R0/branchwise rates are rescaled accordingly. Diagonal entries are recycled if X0 and/or Ysig2 imply more traits. Generally speaking, off-diagonal entries default to 0 if unprovided.

trait.names

Name(s) of simulated trait(s). If a name is not provided and/or NA, defaults to "X<i>" for the ith trait.

n.obs

A vector of the number of observations per tip. Assumed to be in the same order as tree$tip.label if unlabeled. Missing and/or NA entries default to 1 if labeled.


bstaggmartin/evorates documentation built on May 31, 2024, 5:56 a.m.