simulMVSLOUCHProcPhylTree  R Documentation 
Simulate data on a phylogeny under a (multivariate) OUBM model
simulMVSLOUCHProcPhylTree(phyltree, modelParams, regimes = NULL,
regimes.times = NULL, dropInternal = TRUE, M.error=NULL, fullTrajectory=FALSE,
jumpsetup=NULL,keep_tree=FALSE, step=NULL)
phyltree 
The phylogeny in 
modelParams 
List of model parameters of mvOUBM model as 
regimes 
A vector or list of regimes. If vector then each entry corresponds to each of 
regimes.times 
A list of vectors for each tree node, it starts with 0 and ends with the current time of the species.
In between are the times where the regimes (niches) changed. If 
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 recognizes 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.
Hansen, T.F. (1997) Stabilizing selection and the comparative analysis of adaptation. Evolution 51:13411351.
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.
Hansen, T.F. and Pienaar, J. and Orzack, S.H. (2008) A comparative method for studying adaptation to randomly evolving environment. Evolution 62:19651977.
Labra, A., Pienaar, J. & Hansen, T.F. (2009) Evolution of thermophysiology in Liolaemus lizards: adaptation, phylogenetic inertia and niche tracking. The American Naturalist 174:204220.
Pienaar et al (in prep) An overview of comparative methods for testing adaptation to external environments.
mvslouchModel
, SummarizeMVSLOUCH
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 a vector of regimes.
regimes<c("small","small","large","small","small","large","large","large")
### Define SDE parameters to be able to simulate data under the mvOUBM model.
OUBMparameters<list(vY0=matrix(c(1,1),ncol=1,nrow=2),A=rbind(c(9,0),c(0,5)),
B=matrix(c(2,2),ncol=1,nrow=2),mPsi=cbind("small"=c(1,1),"large"=c(1,1)),
Syy=rbind(c(1,0.25),c(0,1)),vX0=matrix(0,1,1),Sxx=matrix(1,1,1),
Syx=matrix(0,ncol=1,nrow=2),Sxy=matrix(0,ncol=2,nrow=1))
### Now simulate the data.
jumpobj<list(jumptype="RandomLineage",jumpprob=0.5,jumpdistrib="Normal",
vMean=rep(0,3),mCov=diag(1,3,3))
OUBMdata<simulMVSLOUCHProcPhylTree(phyltree,OUBMparameters,regimes,NULL,
jumpsetup=jumpobj)
RNGversion(as.character(getRversion()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.