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


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

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:04 +0200
Message-ID <4DA1E330.20903@t-online.de> (permalink)
References <9088euFi3iU1@mid.individual.net>

Show all headers | View raw


On 08.04.2011 13:05, Ingo Thies wrote:

> I am trying to find out how exactly gnuplot calculates the covariance
> matrix for a fitted function.

It does it basically the same way any simple fitting program does it: 
directly from the covariance matrix.  What you're looking at are the 
roots of the diagonal elements of the covariance matrix.

The only major difference is that gnuplot doesn't treat the data errors 
as more believable than the actual distance between model and data. 
This is done by normalizing the covariances by reduced chisquare, 
effectively reducing the meaning of the data errors to that of _weights_ 
for individual data points.

So you get the same parameter errors (and correlations) from multiple 
fits to the same data, but with re-scaled errors:

	fit f(x) 'foo.dat' u 1:2:($3) via ...	
	fit f(x) 'foo.dat' u 1:2:($3*100) via ...
	fit f(x) 'foo.dat' u 1:2:($3/100) via ...
	
all yield the same fit.

> The background: I am still mistrusting the error ellipses one gets from
> the eigenvalues. As already mentioned last year (aroung May or so), I
> suspect that the resulting error contours are underestimated since the
> best-fit chi^2 is assumed to be zero there,but it isn't.

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

> I have compared the error ellipses with the true error contours from an
> independent chi^2-2D-mapping routine, and found that the latter may be
> considerably larger than the ones one would get from gnuplot's cov matrix.

Just in case: please note gnuplot's output is a correlation matrix, not 
a covariance matrix.

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