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

Jari Oksanen jari.oksanen at oulu.fi
Thu Oct 3 14:25:48 CEST 2013


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