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


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

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-12 11:28 +0200
Message-ID <90ik9hF7p0U1@mid.individual.net> (permalink)
References <9088euFi3iU1@mid.individual.net> <908n9pF2jaU1@mid.individual.net> <90e7s7F9faU1@mid.dfncis.de> <90h3ttF39uU1@mid.individual.net> <4DA3725D.3040306@t-online.de>

Show all headers | View raw


On 11.04.2011 23:27, Hans-Bernhard Bröker wrote:

> So, was a comparison of the model function's values for parameter pairs
> (a,b), (a+sigma_a, b+sigma_b) and (a-sigma_a, b-sigma_b) at x=4.0 to the
> data value of y=2.65 +/- 0.1 part of that study?  Did you notice that
> you get a model corridor [after correcting my a<-->b mixup] from 2.13 to
> 3.18, more than 5 times wider than the error in the data?

Well, look at

http://www.astro.uni-bonn.de/~ithies/gnuplot/temp/l2envelope.eps

and the (a,b) contours (for 1,2 and 3 sigma)

http://www.astro.uni-bonn.de/~ithies/gnuplot/temp/l2contour.eps

A colleague actually used gnuplot's errorbars for a linear fit to a set
of about 100 data points. The resulting error contours were *tiny*, but
were OK with the independent approach.

> Or, to keep it short: did you even look at the plot I described?  What's
> actually so wrong with the error corridor you get from gnuplot alone?

My concern here ist that you set the y-offsets of the error lines rather
arbitrary. This approach assumes that the errors are smallest at the
lower end of the xrange, and largest at the upper end, since the error
corridor always opens for larger x. This may be true, if e.g. the errors
are Poisson errors, but it certainly does not have to.

The only honest way, I think, is to calculate a large sample of (a,b)
along the 1-sigma ellipse (or, more precisely, the 1-sigma contour
calculated in a full chi^2 test), and calculate the enveloping curves
for all these resulting functions.

BTW Did you even look at the poster figure I have linked to, where I
have done exactly this (for a small sample, however)?

>> And along this 1-sigma contour a and b walk through
>> the error intervals above.
> 
> So which parameters of the error ellipse did you give above: horizontal
> and vertical section at the center, or overall size of the enclosed,
> axis-aligned bounding box?

All (a,b) at small steps around the ellipse.

> As to using opposite-sign combinations of deviations on the parameters
> --- that's just as bad, but in a different way, since it completely
> underestimates the data errors in the middle of the region.

A first approach then is, just to connect the endpoints of each of these
opposite-sign lines, and use the resulting trapezium as error corridor.
However, this slightly overestimates the errors in the middle.

> The errors you get from gnuplot achieve a much more sensible error band
> with a whole lot less hassle.

This may be true for a moderate number of samples. However, for large
number of samples, as my colleague did, the error corridor is way too
small. By nearly an order of magnitude or so.

-- 
Gruß,
      Ingo

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next 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