[R-sig-eco] vegan RsquareAdj() for lm models

Paolo Piras paolo.piras at uniroma3.it
Thu Oct 3 14:52:48 CEST 2013


Thankyou very much Jari!
I think that it is nearly ok
what I would like to have is the same as in
RsquareAdj(vegan::rda(yy,xx))

that is a GLOBAL measure of the association
BUT...I want it for a multiple-multivariate lm model that does not include the intercept;
an alternative could be to build a rda design for the exclusion of intercept but I really cannot figure out how to do it. 

I think I just need to compute the average of single adjusted r squared from the output of your line of code, 
But the results are not identical 
EXAMPLE  WITH INTERCEPT IN ORDER TO COMPARE WITH RDA

RsquareAdj(vegan::rda(yy,xx))
mean(sapply(summary(lm(yy~xx)), function(x) c("r.squared" = x$r.squared, "adj.r.squared" = x$adj.r.squared))[2,])

Or.... I just miss something in this computation

Thanks again for any further suggestion


________________________________________
Da: Jari Oksanen <jari.oksanen at oulu.fi>
Inviato: giovedì 3 ottobre 2013 14.25
A: Paolo Piras; r-sig-ecology at r-project.org
Oggetto: RE: [R-sig-eco] vegan RsquareAdj() for lm models

Specific reason is that nobody has implemented this. These things don't come by automatic writing, but somebody must do them.

What would you expect to get? Is this what was on your mind:

> sapply(summary(lm(yy~xx-1)), function(x) c("r.squared" = x$r.squared, "adj.r.squared" = x$adj.r.squared))
              Response Y1 Response Y2 Response Y3 Response Y4
r.squared      0.06845032  0.04788037  0.01702738  0.11253059
adj.r.squared -0.01255400 -0.03491264 -0.06844849  0.03535934


This could be implemented, but (1) is this what you or anybody else would like to have?, (2) how many things would it break by returning several values instead of one?

If you want to have this, you really do not need to use vegan. vegan:::RsquareAdj.lm() takes its results from summary(<lm_object>). You can use that stats:::summary.lm directly.

Cheers, Jari Oksanen

________________________________________
From: r-sig-ecology-bounces at r-project.org [r-sig-ecology-bounces at r-project.org] on behalf of Paolo Piras [paolo.piras at uniroma3.it]
Sent: 03 October 2013 14:59
To: r-sig-ecology at r-project.org
Subject: [R-sig-eco] vegan RsquareAdj() for lm models

Dear list,
I would like to easily compute the adjusted R-square in a lm model without intercept (excluding the intercept is essential for my analysis)

I found that RsquareAdj() in vegan returns NA if the argument is  a multiple-multivariate lm model thus including multivariate responses and multiple predictors, while it works for univariate response and multiple predictors.

For example:
library(vegan)

yy<-matrix(rnorm(200,0,1),ncol=4)
xx<-matrix(rnorm(200,0,1),ncol=4)
RsquareAdj(lm(yy~xx-1))
RsquareAdj(lm(yy[,1]~xx-1))



There some specific reason for this behavior?
Thanks in advance for any advice
best regards
Poalo






_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



More information about the R-sig-ecology mailing list