[R-sig-phylo] R-sig-phylo Digest, Vol 46, Issue 12
Emmanuel.Paradis at ird.fr
Tue Nov 15 11:24:19 CET 2011
I know three forms of R² that can be applied to GLS (there may be
others). Tony and Luke gave two; the third one is:
1 - sigma2_M / sigma2_0
sigma2_M: resisual variance of the fitted GLS model
sigma2_0: resisual variance of the null GLS model (intercept-only)
This may be computed with:
m1 <- gls(y ~ x, DF.prim, correlation = co)
m0 <- gls(y ~ 1, DF.prim, correlation = co)
1 - (m1$sigma/m0$sigma)^2
Generally, the three versions will give different values, pointing out
again on the limited usefulness of these coefficients.
BTW, I thought it was generally agreed that R² was of limited interest
even for OLS.
Luke Matthews wrote on 14/11/2011 22:14:
> Tony is correct that a true R2 with the same meaning as in OLS cannot be calculated. Another option would be to use one of the several pseudo R2 values that are derived from likelihoods. These provide some similar interpretations as the real R2. A good explanation of several options can be found on the UCLA help page. Many of these are straightforward to implement in R.
> While I would also prefer to interpret likelihood directly, I have found these pseudo R2 helpful when trying to explain pgls results to people who come more from an R2-focused or method-of-moments analytic tradition. That way the interpretation of likelihoods can be related to a way of thinking they understand.
> Luke Matthews
> Director of Data Analysis
> Activate Networks, Inc.
> -----Original Message-----
> From: r-sig-phylo-bounces at r-project.org [mailto:r-sig-phylo-bounces at r-project.org] On Behalf Of r-sig-phylo-request at r-project.org
> Sent: Monday, November 14, 2011 6:00 AM
> To: r-sig-phylo at r-project.org
> Subject: R-sig-phylo Digest, Vol 46, Issue 12
> Send R-sig-phylo mailing list submissions to
> r-sig-phylo at r-project.org
> To subscribe or unsubscribe via the World Wide Web, visit
> or, via email, send a message with subject or body 'help' to
> r-sig-phylo-request at r-project.org
> You can reach the person managing the list at
> r-sig-phylo-owner at r-project.org
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-sig-phylo digest..."
> Today's Topics:
> 1. Re: R squared in PGLS (Anthony R Ives)
> 2. Re: cophyloplot rotate hangs (Emmanuel Paradis)
> Message: 1
> Date: Sun, 13 Nov 2011 07:37:30 -0600
> From: Anthony R Ives<arives at wisc.edu>
> To: R-phylo Mailing-list<r-sig-phylo at r-project.org>
> Subject: Re: [R-sig-phylo] R squared in PGLS
> Message-ID:<C5BAC30D-C239-4894-8921-64C570DCC6A9 at wisc.edu>
> Content-Type: text/plain
> Here is the problem, which actually doesn't involve transformed space.
> Suppose V is your phylogenetic covariance matrix, and E are your
> estimated residuals. One way to try to get a measure comparable to
> R2 is
> 1 - (E'*V^-1*E)/((Y-y)'*V^-1*(Y-y))
> This is apparently analogous to R2 = 1 - (E'*E)/((Y-y)'*(Y-y)) and
> has the property of being bounded between 0 and 1. The problem is
> that (Y-y)'*V^-1*(Y-y) doesn't have an obvious interpretation,
> because the covariance matrix for Y is not V. Since (Y-y)'*V^-1*(Y-
> y) doesn't have an obvious interpretation, neither does 1 -
> There are other ways to explain this, but I think the one I just gave
> is the simplest.
> I personally wouldn't report an R2 for GLS, but I'm a little prissy
> about things like this.
> Cheers, Tony
>> From: r-sig-phylo-bounces at r-project.org [r-sig-phylo-bounces at r-
>> project.org] on behalf of Bal?zs Lest?r [lestar70 at gmail.com]
>> Sent: Saturday, November 12, 2011 5:15 AM
>> To: r-sig-phylo at r-project.org
>> Subject: [R-sig-phylo] R squared in PGLS
>> Dear All,
>> I think I'm not the only one struggling with getting some kind of
>> showing the amount of variance explained in the dependent variable in
>> phylogenetically controlled models.
>> I know many people will say, that in GLS models we estimate
>> parameters in
>> the transformed data space, and R2 is not reliable in these models.
>> In a standard linear regression (mod<- lm(x~y)) R2 is estimated as
>> fitted(mod)) )^2.
>> Isn't it an appropriate way of estimating the amount of variance
>> Fitted values, are estimated taking into account explanatory
>> variables and
>> phylogeny as well. I know this is a simple correlation of the observed
>> values and the fitted ones, but if it's good for lm(), why wouldn't
>> it be
>> good for PGLS?
>> I guess I'm thinking about this in a much easier way than I
>> should... Just
>> tell me, please if I'm wrong and tell me why.
>> [[alternative HTML version deleted]]
>> R-sig-phylo mailing list
>> R-sig-phylo at r-project.org
> Anthony Ragnar Ives
> Department of Zoology
> (608) 262-1519
> [[alternative HTML version deleted]]
> Message: 2
> Date: Mon, 14 Nov 2011 13:22:13 +0700
> From: Emmanuel Paradis<Emmanuel.Paradis at ird.fr>
> To: "Walter, Mathias"<mathias at walter.gd>
> Cc: r-sig-phylo at r-project.org, damien.de-vienne at crg.es
> Subject: Re: [R-sig-phylo] cophyloplot rotate hangs
> Message-ID:<20111114062348.04462A9A469 at fx405.security-mail.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> This will be hard to debug. This function was written a couple of years
> ago by Damien de Vienne. Since then, the basic plotting functions of ape
> have been improved so that, among other things, it's easier to plot
> several trees on the same device. It would be worth rewritting this
> function. Any volunteer to help?
> Walter, Mathias wrote on 11/11/2011 05:00:
>> I try to rotate a cophyloplot. Unfortunately, it crashes my R GUI
>> (2.13.2 and 2.14.0, Windows) as well as Eclipse 3.7.1 with StatET
>> 2.0.1 on Windows and Eclipse 3.6.2 with StatET 2.0.1 on Fedora 15 and
>> the native R binary started from the shell. It seems like it is
>> depending on the tree size. My tree has 81 leafs.
>> But it also crashes after 3 to 10 rotations with the example from the
>> help. With my larger tree, it hangs immediately. Right before, it
>> prints the node number to the last clicked node. That does not occur,
>> if the rotation succeeds the first few times.
>> The GUIs are not closed. They just hang and it is impossible neither
>> to stop the interaction via right click nor to close the GUI. It has
>> to be killed.
>> Any idea what's going wrong?
>> Kind regards,
IRD, Jakarta, Indonesia
More information about the R-sig-phylo