Learn R Programming

phytools (version 2.4-4)

fitmultiBM: Fits multi-rate discrete character dependent continuous trait evolution

Description

Fits a multi-rate discrete-state-dependent Brownian motion model using the discrete approximation of Boucher & Demery (2016).

Usage

fitmultiBM(tree, x, y=NULL, model="ER", ncat=1, ...)

Value

An object of class "fitmultiBM".

Arguments

tree

object of class "phylo".

x

continuous character data in a vector.

y

optional discrete character, normally in the form of a factor or character vector.

model

discrete character evolution model. (E.g., "ER", "SYM", "ARD".)

ncat

number of rate categories (if hidden rates).

...

optional arguments.

Author

Liam Revell liam.revell@umb.edu

Details

This function uses the discrete approximation of Boucher & Demery (2016) to fit a model in which the rate of Brownian evolution of a continuous trait (in x) depends on the state of a discrete character (in y), where the discrete and continuous character are modeled jointly. If, in fact, the rates of evolution of x depend on the state of y, this will lead to more accurate model parameter estimates than when the discrete and continuous characters are separately modeled.

Optional arguments include parallel (whether to distribute matrix exponentiation across nodes, which defaults to parallel=FALSE), levs (the number of levels for the discrete approximation, which defaults to levs=100), nullmodel (a logical indicating whether or not to fit a null model without state-dependent continuous trait evolution, which defaults to nullmodel=FALSE), and plot_model (a logical indicating whether or not to graph the discretized model prior to fitting, which defaults to plot_model=FALSE).

References

Boucher, F. C., and V. Demery (2016) Inferring bounded evolution in phenotypic characters from phylogenetic comparative data. Systematic Biology, 65, 651-661.

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

See Also

bounded_bm, brownie.lite, fitMk

Examples

Run this code
if (FALSE) {
## load tree and data
data(eel.tree)
data(eel.data)
feed_mode<-setNames(eel.data$feed_mode,
    rownames(eel.data))
lnTL<-setNames(log(eel.data$Max_TL_cm),
    rownames(eel.data))
	
## fit state-dependent model
eel_sdmodel<-fitmultiBM(eel.tree,lnTL,feed_mode,
    model="ARD",parallel=TRUE,levs=100,
    plot_model=TRUE)

## fit null model
eel_nullmodel<-fitmultiBM(eel.tree,lnTL,feed_mode,
    model="ARD",parallel=TRUE,levs=100,
    null_model=TRUE,plot_model=TRUE)

## fit null model with hidden-rates
eel_nullmodel.hrm<-fitmultiBM(eel.tree,lnTL,feed_mode,
    model="ARD",ncat=2,parallel=TRUE,levs=100,
    null_model=TRUE,plot_model=TRUE)

## fit state-dependent model with hidden-rates
eel_sdmodel.hrm<-fitmultiBM(eel.tree,lnTL,feed_mode,
    model="ARD",ncat=2,parallel=TRUE,levs=100,
    plot_model=TRUE)

## compare models
anova(eel_nullmodel,eel_sdmodel,eel_nullmodel.hrm,
    eel_sdmodel.hrm)}

Run the code above in your browser using DataLab