Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #235

Re: Fitting: How does gnuplot calculate the covariance matrix?

From Ingo Thies <ingo.thies@gmx.de>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Fitting: How does gnuplot calculate the covariance matrix?
Date 2011-04-11 22:13 +0200
Message-ID <90h5nvFh1hU1@mid.individual.net> (permalink)
References <9088euFi3iU1@mid.individual.net> <4DA1E330.20903@t-online.de>

Show all headers | View raw


Am 2011-04-10 19:04, schrieb Hans-Bernhard Bröker:

> Nobody expects chi^2 to be zero. The expectation is for the reduced
> chisquare (chisq/ndf) to be about 1.0.

You might have misunderstood me. If you want to calculate the 1-sigma 
ellipse from the actual chi^2 in the (a,b) map (this cannot be done with 
gnuplot yet, but with a simple independent program), one has to 
transform the chi^2 into the exclusion probability (via the incomplete 
gamma function and the degree of freedom), and then transform this into 
sigma via the (inverse) error function.

But before you throw the chi^2 into this algorithm, you have to 
substract the chi_min^2, the chi^2 of the best-fit (a,b). I.e. "0 sigma" 
corresponds to chi^2=chi_min^2, not 0. Otherwise you get too small error 
contours, and for bad fits, the 1-sigma contour might not even exist.

I have to admit that I had indeed neglected to do this correction in 
Thies & Kroupa (2007), Figure 9. Plotted there are the 95% and 99% (i.e. 
2 and 2.6 sigma) contours for the fitted parameters of four initial mass 
functions (IMF). The fit to the Taurus IMF was relatively poor, with the 
probability being >95%, making the 2-sigma contour disappear without the 
correction mentioned above (however, the main result is not affected by 
this lapsus). This shows the consequence of missing this correction.

Here the paper on arxiv: <http://arxiv.org/abs/0708.1764>

What has all this to do with gnuplot?

Well, if the errors of the data are near-Gaussian, you can approximate 
the error contour in the (a,b) space by an ellipse. The axis vectors of 
this ellipse are, as far as I remember, the eigenvectors of the 
covariance matrix which is closely related to the correlation matrix by 
multiplying/dividing with/by the product of the standard errors of a and b.

However, the error corridor you get from walking around the error 
ellipse and picking (a,b) and use it in f(x), is too narrow. As far as I 
remember, it is similar to the 1-sigma (a,b) error contour if chi_min^2 
is not subtracted. This, the other way round, corresponds to too small 
a,b standard errors.


-- 
Gruß,
       Ingo

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Find similar


Thread

Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-08 13:05 +0200
  Re: Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-08 17:18 +0200
    Re: Fitting: How does gnuplot calculate the covariance matrix? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2011-04-10 19:31 +0200
      Re: Fitting: How does gnuplot calculate the covariance matrix? Charles Allen <ca137tmp@earthlink.net> - 2011-04-10 20:14 -0500
        Re: Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-14 15:41 +0200
      Re: Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-11 21:42 +0200
        Re: Fitting: How does gnuplot calculate the covariance matrix? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2011-04-11 23:27 +0200
          Re: Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-12 11:28 +0200
            Re: Fitting: How does gnuplot calculate the covariance matrix? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2011-04-16 00:03 +0200
              Re: Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-16 18:06 +0200
      Re: Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-14 15:07 +0200
      Re: Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-15 13:47 +0200
  Re: Fitting: How does gnuplot calculate the covariance matrix? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2011-04-10 19:04 +0200
    Re: Fitting: How does gnuplot calculate the covariance matrix? Ingo Thies <ingo.thies@gmx.de> - 2011-04-11 22:13 +0200

csiph-web