[R] How to get the adjusted R squared from GLS() estimator

Chris Wilkinson kinsham at verizon.net
Fri Mar 14 13:25:32 CET 2014


You could fit a linear model to original/predicted y values and get rsquared from that.

Chris

On Mar 13, 2014 5:26 PM, Greg Snow <538280 at gmail.com> wrote:
>
> 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}} 
>
> ______________________________________________ 
> R-help at r-project.org mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-help 
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
> and provide commented, minimal, self-contained, reproducible code. 


More information about the R-help mailing list