This function automatically calculates prior distributions for the rate of trait evolution under the Brownian Motion (BM) model on a discrete time-scale, at a given timeStep, in the sense that that variable is used with other TreEvo functions like doRun_prc.

getBMRatePrior(phy, traits, timeStep, verbose = TRUE)

Arguments

phy

A phylogenetic tree, in package ape's phylo format.

traits

Data matrix with rownames identical to phy@tip.label. If a vector, traits will be coerced to a matrix, with element names as rownames.

timeStep

time in a single iteration of the discrete-time simulation

verbose

If TRUE, gives messages about how the simulation is progessing via message.

Value

Returns a matrix of prior values

Details

Returns a matrix of prior values that can be used in the doRun functions. Builds on functions in phylolm to estimate distribution.

Author

Brian O'Meara and Barb Banbury

Examples

data(simRunExample) #timeStep = 0.1 -> effectively ~100 steps over the tree length getBMRatePrior(phy = simPhyExample, traits = simCharExample, timeStep = 0.01, verbose = TRUE)
#> BM rate prior is an exponential distribution with a mean value approximately equal to the likelihood estimation
#> LikelihoodRateEst = 0.0356374445727963; Mean of exp distribution for prior is ~0.0355725581947384; expected rate estimate= 28.0603733513302
#> [1] 28.06037