[R-sig-phylo] phylogenetically-informed Reduced Major Axis regression in R?
Dear members: Does anyone know of scripts to both estimate and test phylogenetically-corrected RMA regression slopes (perhaps using the relevant equations from Ives et al. (Syst. Biol. 2007))? Cheers, Arne Mooers __ Dr. Arne Mooers Biological Sciences, Simon Fraser University Burnaby, BC Canada V5A 1S6 tel. +1 778 782 3979 skype: arnemooers http://www.sfu.ca/~amooers http://www.sfu.ca/fabstar http://www.scientists-4-species.org ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] phylogenetically-informed Reduced Major Axis regression in R?
Hi Arne, Just calculating the slope is straightforward. For tree and column vectors x y (in order tree$tip.label): C-vcv.phylo(tree) ax-sum(solve(C,x))/sum(solve(C)) ay-sum(solve(C,y))/sum(solve(C)) beta1-sqrt(t(y-ay)%*%solve(C,y-ay)/(t(x-ax)%*%solve(C,x-ax))) The model intercept can be obtained by plotting the slope through the phylogenetic mean of x y. beta0-ay-beta1*ax I wrote a function to do this; but also to (optionally) fit Pagel's lambda jointly for x y and to return the residuals in y. I did this last year, and then fixed a few bugs/errors when I saw your query this morning. I have put it online here: http://anolis.oeb.harvard.edu/~liam/R-phylogenetics/phy.RMA/v0.1/phyl.RMA.R. Note, that this *does not* test hypotheses about the RMA regression nor does it incorporate individual variation (as in the Ives et al. 2007 article). Adding the former would be fairly simple using equations 15 of Ives et al., I think (I will do this when I get a chance); adding the latter not so much. I believe Tony Ives may have MATLAB code that does this already. Maybe he can comment. I hope this is somewhat helpful. Sincerely, Liam -- Liam J. Revell University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://phytools.blogspot.com On 4/20/2011 2:27 AM, Arne Mooers wrote: Dear members: Does anyone know of scripts to both estimate and test phylogenetically-corrected RMA regression slopes (perhaps using the relevant equations from Ives et al. (Syst. Biol. 2007))? Cheers, Arne Mooers __ Dr. Arne Mooers Biological Sciences, Simon Fraser University Burnaby, BC Canada V5A 1S6 tel. +1 778 782 3979 skype: arnemooers http://www.sfu.ca/~amooers http://www.sfu.ca/fabstar http://www.scientists-4-species.org ___ 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
[R-sig-phylo] Phylogenetic correlation
Dear R users, I am trying to compare correlation's among traits without phylogeny and with accounting for phylogenetic history (each data point is a species mean trait value). There is no clear predictor and no clear response variable between two traits. I thought that regression through the origin with independent contrasts was the correct method for this question, but if there is no clear predictor and no clear response, should correlation be used instead of regression? If so, are there any R functions that do this phylogenetic correlation? Thanks! Scott [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] phylogenetically-informed Reduced Major Axis regression in R?
Liam said: Just calculating the slope is straightforward. For tree and column vectors x y (in order tree$tip.label): The relevant point to keep in mind is that once you have made maximum likelihood estimates of the means, variances and covariances of the variables, the Reduced Major Axis is simply a function of these, and its ML estimate is that function of the ML estimates of the covariances. You don't need to do any separate ML estimation for the RMA. If you want to test hypotheses about the RMA, if you can recast them as hypotheses about the slopes and correlations (say that the slope is zero) then the test can be done there, and no separate test of the RMA is needed. In the next release of my program Contrast in PHYLIP, I will have an option to print out the RMA and its other axes, which did not involve anything more complicated than computing them from the covariances that it was already estimating. Joe Joe Felsenstein, j...@gs.washington.edu Dept. of Genome Sciences, Univ. of Washington Box 355065, Seattle, WA 98195-5065 USA ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Ives et al. 2007 Matlab code converted to R code?
Scott, I would love it if somebody would. If I were doing it now, I'd simultaneously use an OU or maybe lambda transform. Several people have code that does, for example, regression while assuming residual variation has some non-Brownian phylogenetic structure (e.g., Lavins et al. 2008). There should be no problem adding measured measurement error. I am slowly moving to R, but slowly. Cheers, Tony On Apr 20, 2011, at 10:29 AM, Scott Chamberlain wrote: Thanks Arne, Apologies for not noticing the similar post. Scott On Wednesday, April 20, 2011 at 10:27 AM, Arne Mooers wrote: Hi Scott: Tony hasn't, Liam has estimates for the slope, but no c.i.s on that slope. I'm playing around with this too at the moment (just posted a query re. Reduced major axis regression). Arne On 20-04-2011, at 8:16 AM, Scott Chamberlain wrote: Dear R users, I am curious if anyone has re-written the Matlab code given in Ives et al. 2007 Syst. Biol. (for including within species measurement error into examining relationships among traits) for use in R. Thanks! Scott [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo _ Dr. Arne Mooers Biosciences, Simon Fraser University University Blvd., Burnaby BC +1 778 782 3979 www.sfu.ca/~amooers www.sfu.ca/fabstar www.scientists-4-species.org amoo...@sfu.ca [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Anthony Ragnar Ives Department of Zoology UW-Madison (608) 262-1519 [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] phylogenetically-informed Reduced Major Axis regression in R?
I think it is important to point out, that while RMA may superficially be an attractive method, it relies on the ratio of error variances being unity. This is almost always incorrect. It usually results in a massive over-correction of the slope bias with respect to the OLS estimator. That is, the slope is made much too steep. I would not encourage anyone to use RMA for anything other than in the case where there is sufficient within-species replication to estimate the error variances with some precision, and then use an appropriate generalization of RMA that allows for the variance ratio to be other than unity. Fiddling around with phylogenetically-informed RMA is like rearranging the deck chairs on the Titanic. The problem is discussed in depth in: R. J. Carroll and D. Ruppert 1996, The Use and Misuse of Orthogonal Regression in Linear Errors-in-Variables Models. The American Statistician, Vol. 50, No. 1, pp. 1-6 Carroll et al. 2006, Measurement Errors in Nonlinear Models. A Modern Perspective. 2nd Edition, Chapman Hall. Chapter 3. Simon. This is On 21/04/11 01:13, Joe Felsenstein wrote: Liam said: Just calculating the slope is straightforward. For tree and column vectors x y (in order tree$tip.label): The relevant point to keep in mind is that once you have made maximum likelihood estimates of the means, variances and covariances of the variables, the Reduced Major Axis is simply a function of these, and its ML estimate is that function of the ML estimates of the covariances. You don't need to do any separate ML estimation for the RMA. If you want to test hypotheses about the RMA, if you can recast them as hypotheses about the slopes and correlations (say that the slope is zero) then the test can be done there, and no separate test of the RMA is needed. In the next release of my program Contrast in PHYLIP, I will have an option to print out the RMA and its other axes, which did not involve anything more complicated than computing them from the covariances that it was already estimating. Joe Joe Felsenstein, j...@gs.washington.edu Dept. of Genome Sciences, Univ. of Washington Box 355065, Seattle, WA 98195-5065 USA ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo -- Simon Blomberg, BSc (Hons), PhD, MAppStat. Lecturer and Consultant Statistician School of Biological Sciences The University of Queensland St. Lucia Queensland 4072 Australia T: +61 7 3365 2506 email: S.Blomberg1_at_uq.edu.au http://www.uq.edu.au/~uqsblomb/ Policies: 1. I will NOT analyse your data for you. 2. Your deadline is your problem Statistics is the grammar of science - Karl Pearson. ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo