simulBMProcPhylTree  R Documentation 
Simulate data on a phylogeny under a (multivariate) Brownian motion model
simulBMProcPhylTree(phyltree, X0, Sigma, dropInternal = TRUE, M.error=NULL,
fullTrajectory=FALSE, jumpsetup=NULL, keep_tree = FALSE, step=NULL)
phyltree 
The phylogeny in 
X0 
The ancestral, root state. 
Sigma 
The diffusion matrix of the Brownian motion. 
dropInternal 
Logical whether the simulated values at the internal nodes should be dropped. 
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 
fullTrajectory 
Should the full realization of the process or only node and tip values be returned 
jumpsetup 
Either

keep_tree 
Logical whether the used tree should be saved inside the output object. Useful for any future reference, but as the tree is enhanced for mvSLOUCH's needs the resulting output object may be very large (it the number of tips is large). 
step 
The step size of the simulation. 
If fullTrajectory
is FALSE
then
returns a matrix with each row corresponding to a tree node and each column to a trait.
Otherwise returns a more complex object describing the full realization of the process on the tree.
If dropInternal
is TRUE
, then the entries for the internal nodes are changed to
NA
s. The ordering of the rows corresponds to the order of the nodes (their indices) in
the phylo
object. Hence, the first n
rows will be the tip rows
(by common phylo
convention).
Krzysztof Bartoszek
Bartoszek, K. (2014) Quantifying the effects of anagenetic and cladogenetic evolution. Mathematical Biosciences 254:4257.
Bartoszek, K. (2016) A Central Limit Theorem for punctuated equilibrium. arXiv:1602.05189.
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:204215.
Butler, M.A. and A.A. King (2004) Phylogenetic comparative analysis: a modeling approach for adaptive evolution. American Naturalist 164:683695.
Felsenstein, J. (1985) Phylogenies and the comparative method. American Naturalist 125:115.
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):413425.
Pienaar et al (in prep) An overview of comparative methods for testing adaptation to external environments.
BrownianMotionModel
, SummarizeBM
RNGversion(min(as.character(getRversion()),"3.6.1"))
set.seed(12345, kind = "MersenneTwister", 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.
jumpobj<list(jumptype="RandomLineage",jumpprob=0.5,jumpdistrib="Normal",
vMean=rep(0,3),mCov=diag(1,3,3))
BMdata<simulBMProcPhylTree(phyltree,X0=BMparameters$vX0,Sigma=BMparameters$Sxx,
jumpsetup=jumpobj)
RNGversion(as.character(getRversion()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.