[R-sig-phylo] retrieving simulated ancestral states from sim.char{geiger}

2010-08-04 Thread Sebastien Lavergne
Hi everybody, I have a question regarding the sim.char function in geiger. Does anybody foresee an easy way to retrieve the simulated ancestral states ? (i.e. the values of each trait for all internal nodes of the tree) Does this sound doable ? Any hint about how to do it ? Thanks for your

Re: [R-sig-phylo] retrieving simulated ancestral states from sim.char{geiger}

2010-08-04 Thread Sebastien Lavergne
I forgot to mention that I am willing to do this with continuous traits. Thanks to those who already answered (about discrete characters unfortunately). Seb Le 04/08/2010 15:03, Sebastien Lavergne a écrit : Hi everybody, I have a question regarding the sim.char function in geiger. Does

Re: [R-sig-phylo] Question regarding simulate character option in geiger

2010-08-04 Thread Liam J. Revell
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

Re: [R-sig-phylo] retrieving simulated ancestral states from sim.char{geiger}

2010-08-04 Thread Carl Boettiger
Hi Sebastien, I believe the simulation simply draws random numbers from the appropriate multivariate normal distribution determined by the model's covariance matrix for the tip values. This means that a complete trajectory of trait values in never actually generated. This is much more efficient

Re: [R-sig-phylo] retrieving simulated ancestral states from sim.char{geiger}

2010-08-04 Thread Joe Felsenstein
Luke wrote: The simulations in Geiger do draw from a mvn distribution but - in an unnecessary step - draw random numbers for every branch and use matrix multiplication to get the tip values. This is kind of dumb and needlessly slow but does give you the right answer. Carl is correct that

Re: [R-sig-phylo] retrieving simulated ancestral states from sim.char{geiger}

2010-08-04 Thread Liam J. Revell
Hi all. Here is some code that I think will do what Dr. Felsenstein has suggested for a single character. It returns a vector containing the simulated states at all internal or terminal nodes, numbered according to the numbers used in tree$edge. Happy to hear if this works. See below: #

[R-sig-phylo] Errors with ace and Confidence Intervals for Ancestral Traits

2010-08-04 Thread David Bapst
Hello all, I have been using ace() to reconstruct ancestral states for a number of continuous morphological traits. I need confidence intervals for my analysis. However, for some sets of traits, I get the following error: Warning message: In sqrt(diag(solve(out$hessian))) : NaNs produced The

Re: [R-sig-phylo] retrieving simulated ancestral states from sim.char{geiger}

2010-08-04 Thread Sebastien Lavergne
Thank you all for these nice and very very helpful answers... it seems that I have some work to do for a little while now. I'll give a try to all the hints and pieces of code you sent me, and may get back to you off-list for feedbacks or more precise requests. Thanks again Seb Le 04/08/2010

Re: [R-sig-phylo] Errors with ace and Confidence Intervals for Ancestral Traits

2010-08-04 Thread Annat Haber
Hi Dave and everyone, From the responses I got to my email a few months ago, it seems to be related to having a lot of polytomies or zero-length branches. adding a small number to the branch length doesn't help if there are many of them because the matrix is still very near singular and the