[R] How to get the adjusted R squared from GLS() estimator
Greg Snow
538280 at gmail.com
Thu Mar 13 22:26:43 CET 2014
Well if I had it and you asked nicely, then I would be happy to give
it to you. Oh, you mean the gls function, not GLS as my initials (my
parents are OLS and WLS, perhaps I was destined to regress), sorry.
The gls function in the nlme package (is that the one that you are
asking about? or is there another gls function?) fits using maximum
likelihood (or restricted maximum likelihood) rather than looking at
sums of squares, so an adjusted r-squared is not a direct result like
in ordinary least squares. The idea of r-squared does not really
translate well to models beyond ordinary least squares (see
fortune(252), fortune(253), and fortune(254)), so adjusted r-squared
would not either.
There are other measures of overall model fit that penalize or adjust
for the number of terms in the model, e.g. AIC and BIC, perhaps one of
those would be better for what you are trying to accomplish.
One possibility would be to square the correlation between the
original y-values and the predicted y-values (y-hats) as an estimate
of r-squared, then apply the same adjustment
(http://en.wikipedia.org/wiki/Adjusted_R-squared#Adjusted_R2), but
there is no guarantee that it has the same effect for the generalized
model (might be an interesting project for a student to look at this
by simulation). I would suggest looking into AIC or BIC instead.
On Thu, Mar 13, 2014 at 9:59 AM, Yuan, Rebecca
<rebecca.yuan at bankofamerica.com> wrote:
> Hello,
>
> Although lm() gives a way to get the adjusted R squared by
>
> adjr2 <- summary(mdl)$adj.r.squared
>
>
> I cannot find a way to extract the adjusted R squared from gls(), any hint?
>
> Thanks,
>
> Rebecca
>
> ----------------------------------------------------------------------
> This message, and any attachments, is for the intended...{{dropped:14}}
More information about the R-help
mailing list