This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
Re: computing R-squared with gsl_multifit
> Yes, as it relates 'explained sum of squares' to 'total sum of
> squares', so it just uses residuals, irrespective of whether these
> were computed with a unit vector of weights, or with actual weights.
>
> Wikipedia is not a bad start:
> http://en.wikipedia.org/wiki/R-squared
Well, that wiki page says:
"If fitting is by weighted least squares or generalized least squares,
alternative versions of R2 can be calculated appropriate to those
statistical frameworks,"
If you use the weights in calculating the residuals then it seems
you'd have to use them in the total sum of squares too. In the GNU
R source, the file src/library/stats/R/lm.R has the code which
calculates R^2 and it definitely takes weights into account for
both the residuals and the total sum of squares.