From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23730 invoked by alias); 26 Sep 2007 16:26:31 -0000 Received: (qmail 23722 invoked by uid 22791); 26 Sep 2007 16:26:31 -0000 X-Spam-Check-By: sourceware.org Received: from sccrmhc11.comcast.net (HELO sccrmhc11.comcast.net) (204.127.200.81) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 26 Sep 2007 16:26:24 +0000 Received: from hippogriff.homeunix.org ([24.8.97.215]) by comcast.net (sccrmhc11) with ESMTP id <2007092616262201100kdl6se>; Wed, 26 Sep 2007 16:26:22 +0000 Received: by hippogriff.homeunix.org (Postfix, from userid 1000) id 1641331B6F; Wed, 26 Sep 2007 10:26:29 -0600 (MDT) Date: Wed, 26 Sep 2007 16:26:00 -0000 From: Patrick Alken To: gsl-discuss@sourceware.org Subject: Re: computing R-squared with gsl_multifit Message-ID: <20070926162628.GB27449@hippogriff.physics.drexel.edu> References: <20070925194628.GA22578@hippogriff.physics.drexel.edu> <20070926161818.GA6539@eddelbuettel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070926161818.GA6539@eddelbuettel.com> User-Agent: Mutt/1.4.2.2i Mailing-List: contact gsl-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00045.txt.bz2 > 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.