Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?ISO-8859-1?Q?Hans-Bernhard_Br=F6ker?= Newsgroups: comp.graphics.apps.gnuplot Subject: Re: Fitting: How does gnuplot calculate the covariance matrix? Date: Sun, 10 Apr 2011 19:04:48 +0200 Lines: 39 Message-ID: <4DA1E330.20903@t-online.de> References: <9088euFi3iU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.dfncis.de Y/zrkfUTVmbb9DVO8Hp3qwgM3RyoHuhcQX3DNlhQIL+rzOZLuJhq7vaWnh Cancel-Lock: sha1:9wZYdGPkAOxDPAZF/1a+nc21HdA= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: <9088euFi3iU1@mid.individual.net> Xref: x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:226 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.