| BrownianMotionModel | R Documentation |
The BrownianMotionModel function uses maximum likelihood to fit parameters of a Brownian
motion model evolving on the phylogeny. The user is recommended to install the suggested package
PCMBaseCpp which significantly speeds up the calculations (see Details).
BrownianMotionModel(phyltree, mData, predictors = NULL, M.error = NULL,
min_bl = 0.0003)
phyltree |
The phylogeny in |
mData |
A matrix with the rows corresponding to the tip species while the columns correspond to the traits.
The rows should be named by species |
predictors |
A vector giving the numbers of the columns from
|
M.error |
An optional measurement error covariance structure. The measurement errors between species are assumed independent. The program tries to recognize the structure of the passed matrix and accepts the following possibilities :
From version |
min_bl |
Value to which PCMBase's |
The likelihood calculations are done by the PCMBase package. However, there is a C++ backend, PCMBaseCpp. If it is not available, then the likelihood is calculated slower using pure R. However, with the calculations in C++ up to a 100-fold increase in speed is possible (more realistically 10-20 times). The PCMBaseCpp package is available from https://github.com/venelin/PCMBaseCpp.
This function estimates the parameters of a multivariate Brownian motion model defined by the SDE,
dX(t) = \Sigma dB(t), X(0)=X_{0}
evolving on a phylogenetic tree.
Without measurement error the parameters are obtained analytically via a GLS procedure.
If measurement error is present, then the parameters are optimized over using optim().
The initial conditions for the optimization are motivated by Bartoszek \& Sagitov (2015)'s
univariate results.
From version 2.0.0 of mvSLOUCH the data has to be passed as a matrix.
To underline this the data parameter's name has been changed to mData.
The phyltree_paths() function enhances the tree for usage by mvSLOUCH.
Hence, to save time, it is advisable to first do phyltree<-mvSLOUCH::phyltree_paths(phyltree)
and only then use it with BrownianMotionModel().
From version 2.0.0 of mvSLOUCH the parameter calcCI has been removed.
The package now offers the possibility of bootstrap confidence intervals, see
function parametric.bootstrap.
ParamsInModel |
A list with estimated model parameters. The elements are |
ParamSummary |
A list with summary statistics with elements,
|
Krzysztof Bartoszek
Bartoszek, K. and Fuentes-Gonzalez, J. and Mitov, V. and Pienaar, J. and Piwczynski, M. and Puchalka, R. and Spalik, K. and Voje, K. L. (2024) Analytical advances alleviate model misspecification in non-Brownian multivariate comparative methods, Evolution 78(3):389-400.
Bartoszek, K. and Pienaar, J. and Mostad. P. and Andersson, S. and Hansen, T. F. (2012) A phylogenetic comparative method for studying multivariate adaptation. Journal of Theoretical Biology 314:204-215.
Bartoszek, K. and Sagitov S. (2015) A consistent estimator of the evolutionary rate. Journal of Theoretical Biology 371:69-78.
Butler, M.A. and A.A. King (2004) Phylogenetic comparative analysis: a modeling approach for adaptive evolution. American Naturalist 164:683-695.
Felsenstein, J. (1985) Phylogenies and the comparative method. American Naturalist 125:1-15.
Hansen, T.F. and Bartoszek, K. (2012) Interpreting the evolutionary regression: the interplay between observational and biological errors in phylogenetic comparative studies. Systematic Biology 61(3):413-425.
Mitov, V. and Bartoszek, K. and Asimomitis, G. and Stadler, T. (2020) Fast likelihood calculation for multivariate Gaussian phylogenetic models with shifts Theoretical Population Biology 131:66-78.
Pienaar et al (in prep) An overview of comparative methods for testing adaptation to external environments.
brown,mvBM, PCMLik,
SummarizeBM, simulBMProcPhylTree, parametric.bootstrap
RNGversion(min(as.character(getRversion()),"3.6.1"))
set.seed(12345, kind = "Mersenne-Twister", normal.kind = "Inversion")
### We will first simulate a small phylogenetic tree using functions from ape.
### For simulating the tree one could also use alternative functions, e.g. sim.bd.taxa
### from the TreeSim package
phyltree<-ape::rtree(5)
## The line below is not necessary but advisable for speed
phyltree<-phyltree_paths(phyltree)
### Define Brownian motion parameters to be able to simulate data under
### the Brownian motion model.
BMparameters<-list(vX0=matrix(0,nrow=3,ncol=1),
Sxx=rbind(c(1,0,0),c(0.2,1,0),c(0.3,0.25,1)))
### Now simulate the data.
BMdata<-simulBMProcPhylTree(phyltree,X0=BMparameters$vX0,Sigma=BMparameters$Sxx)
BMdata<-BMdata[phyltree$tip.label,,drop=FALSE]
### Recover the parameters of the Brownian motion.
BMestim<-BrownianMotionModel(phyltree,BMdata)
## Not run:
### And finally obtain bootstrap confidence intervals for some parameters
BMbootstrap<-parametric.bootstrap(estimated.model=BMestim,phyltree=phyltree,
values.to.bootstrap=c("vX0","StS"),M.error=NULL,numboot=2)
## End(Not run)
RNGversion(as.character(getRversion()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.