From: Brian Gough <bjg@network-theory.co.uk>
To: gsl-discuss@sourceware.org
Subject: Re: computing R-squared with gsl_multifit
Date: Tue, 02 Oct 2007 08:35:00 -0000 [thread overview]
Message-ID: <87zlz1rk2k.wl%bjg@network-theory.co.uk> (raw)
In-Reply-To: <20070926162005.GA27449@hippogriff.physics.drexel.edu>
At Wed, 26 Sep 2007 10:20:05 -0600,
Patrick Alken wrote:
>
> > A question: is the formula the same for both weighted and unweighted
> > fits?
>
> No, unfortunately.
>
> R^2 = 1 - chisq / Sum [ w_i * (y_i - mean(y))^2 ].
>
> In the case of weighted data, the mean(y) is also a weighted mean:
>
> mean(y) = 1/sum [ w_i ] * sum [ w_i y_i ]
>
> I looked at the GNU R source to verify all this.
As a starting point I've added gsl_stats_ss and gsl_stats_wss for
computing the unweighted/weighted sum of squares.
Given chisq and the data this is sufficient for computing R^2 with the
formula above.
--
Brian Gough
prev parent reply other threads:[~2007-10-02 8:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-25 19:46 Patrick Alken
2007-09-26 15:52 ` Brian Gough
2007-09-26 16:18 ` Dirk Eddelbuettel
2007-09-26 16:26 ` Patrick Alken
2007-09-26 16:43 ` Dirk Eddelbuettel
2007-09-26 16:20 ` Patrick Alken
2007-10-02 8:35 ` Brian Gough [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zlz1rk2k.wl%bjg@network-theory.co.uk \
--to=bjg@network-theory.co.uk \
--cc=gsl-discuss@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).