A good general reference for r^2 is: @ARTICLE{generalized.r^-1, author = {Nagelkerke, N. J. D.}, title = {A Note on a General Definition of the Coefficient of Determination}, journal = {Biometrika}, year = {1991}, volume = {78}, pages = {691-692}, number = {3} }
Simon. 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. -----Original Message----- From: r-sig-phylo-boun...@r-project.org on behalf of Anthony R Ives Sent: Sat 10/10/2009 9:40 AM To: Ramona Walls Cc: r-sig-phylo@r-project.org Subject: Re: [R-sig-phylo] r-squared for PGLS regression Dear Ramona, There are multiple ways that you could calculate an R2 for GLS. The best form of R2 is (in matlab code) R2=1-(e'*invV*e)/((Y-a)'*invV*(Y-a)) where e are the residuals, invV is the inverse of the covariance matrix, Y contains the data, and a is the GLS mean of Y, a=(ones(n,1)'*invV*ones(n,1))\(ones(n,1)'*invV*Y) But this is not a perfect measure and cannot be directly compared to R2 calculated from LS. This is discussed in the last paragraph of the supplement (p.546) to Lavin, S. R., W. H. Karasov, A. R. Ives, K. M. Middleton, and T. Garland, Jr. 2008. Morphometrics of the avian small intestine, compared with non-flying mammals: a phylogenetic approach. Physiological and Biochemical Zoology 81:526-550. I will send you a reprint in a separate email. I hope this helps. Cheers, Tony On Oct 9, 2009, at 2:58 PM, Ramona Walls wrote: > I am using the ls function in nlme to conduct PGLS regression, with a > correlation structure based on the maximum likelihood value of lambda > (this seems to be the best-fitting model of evolution for my data). > Unlike > the lm function, ls does not return r-squared values. I suspect > this may > be because computing r-squared with an atypical error-variance > matrix is > not so straightforward. I tried to calculate r-squared myself, > based on > the residuals from the PGLS regression and standard formula (SS > explained > by regression divided by total SS), but the number I got back was much > higher than I expected. I think I am using the right formula, > because if > I calculate r-squared from the ls regression of the same data using a > regular error matrix, I get the same value as what is returned when > I do a > a regression using the lm function. Is there a way to calculate r- > squared > for PGLS regression? Do I need to use different estimates of the mean > value of Y, because of the phylogenetic correction? Does it matter > that > my data have been log transformed? Can anyone provide me with R > code to do > this. > > Thank you! > > > _____________________________________ > > Ramona Walls > Ph.D. > Department of Ecology and Evolution > Stony Brook University > Stony Brook, NY 11794-5245 > rwa...@life.bio.sunysb.edu > > _______________________________________________ > 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 [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo