Groups | Search | Server Info | Keyboard shortcuts | Login | Register


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

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

From Hans-Bernhard Bröker <HBBroeker@t-online.de>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Fitting: How does gnuplot calculate the covariance matrix?
Date 2011-04-10 19:31 +0200
Message-ID <90e7s7F9faU1@mid.dfncis.de> (permalink)
References <9088euFi3iU1@mid.individual.net> <908n9pF2jaU1@mid.individual.net>

Show all headers | View raw


On 08.04.2011 17:18, Ingo Thies wrote:

> Another point seems to be even more problematic, that is the usage of
> the "asymptotic standard error".

That's actually not another point, it's exactly the same.

> Gnuplot finds:
>
> Final set of parameters            Asymptotic Standard Error
> =======================            ==========================
>
> a               = 0.948209         +/- 0.04083      (4.306%)
> b               = 0.427096         +/- 0.01746      (4.089%)
>
>
> correlation matrix of the fit parameters:
>
>                 a      b
> a               1.000
> b              -0.855  1.000
>
>
> while an independent approach finds
>
> a = 9.482095E-01 -/+-1.947044E-01, 1.947043E-01
> b = 4.270960E-01 -/+-8.327496E-02, 8.327495E-02

Those errors are _way_ too big.  Do yourself a favour and plot your data 
along with the model, using parameters modified by those errors:

[assuming 'set fit errorvar' active, and fit done:]

gnuplot> p 'fit.dat' u 1:2:3 w err, a*x+b w l
gnuplot> rep (a+a_err)*x+b+b_err, (a-a_err)*x+b-b_err
gnuplot> a_thies=0.195
gnuplot> b_thies=.083
gnuplot> rep (a+a_thies)*x+b+b_thies, (a-a_thies)*x+b-b_thies

You'll see that gnuplot's a_err and b_err yield a corridor somewhat 
tightly containing almost all data points and their errors, just like it 
should be.

Your independent approach defines a corridor that is way larger than it 
needs to be.  Particularly the error on 'a' leads to a massive 
overestimation of the data errors at large 'x'.  E.g. at x==4, the model 
with those parameter errors yields an interval of 2.6 +/- 0.8, while 
your data claimed 2.6 +/- 0.1

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