Hi Alejandro.
Your code won't work because model.matrix in sim.char() is the
variance-covariance matrix for the traits, not the species.
What you can do instead is the following:
> cp<-corMartins(2.5,tree,fixed=T)
> C<-corMatrix(Initialize(cp,data))
> rownames(C)<-tree$tip.label # naming the rows and columns
ensures that the data vector will have labeled rows
> colnames(C)<-rownames(C)
> x<-chol(C)%*%rnorm(length(tree$tip.label))
Or alternatively you can do the following using sim.char():
> s<-matrix(1,1,1)
> x<-sim.char(ouTree(tree,alpha=2.5),model.matrix=s,model="brownian")
# for instance
There are also several other related transformations, such as
lambdaTree() and deltaTree. These can be reviewed by querying:
> ?ouTree
Hope this is of some help.
Sincerely, Liam
Liam J. Revell
NESCent, Duke University
web: http://anolis.oeb.harvard.edu/~liam/
NEW email: lrev...@nescent.org
Alejandro Gonzalez V wrote:
Hello,
I have a question about the simulate character command in geiger. I want to
generate simulations of trait evolution under different models to estimate
variance around the estimate of evolutionary parameters for that trait. I've
seen in previous posts in the list that characters can be simulated under
distinct evolutionary models by transforming the phylogenetic tree prior to the
simulation. I was wondering if the same could be done by instead adjusting the
model matrix. Specifically I was wondering if ape's corPagel or corMartins
could be used to specify different matrices adjusted to distinct values of
lambda or alpha instead of transforming the tree. Would this be an appropriate
alternative to tree transformation prior to simulations?
For example I was thinking of doing something of this sort for a model with
alpha of 2.5 with a phylo object called tree and table with a trait called data:
cp<-corMartins(2.5, tree, fixed=TRUE)
C<-corMatrix(Initialize(cp, data))
sim.char(tree, model.matrix=C, nsims=100, model="brownian")
Cheers,
Alejandro
__________________________________
Alejandro Gonzalez Voyer
Post-doc
NEW ADDRESS & NEW E-MAIL
Estación Biológica de Doñana (CSIC)
Avenida Américo Vespucio s/n
41092 Sevilla
Spain
E-mail: alejandro.gonza...@ebd.csic.es
Tel: +34- 954 466700, ext 1749
Website (From my previous position):
http://www.iee.uu.se/zooekol/default.php?type=personalpage&lang=en&id=146
[[alternative HTML version deleted]]
------------------------------------------------------------------------
_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo