Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!news-transit.tcx.org.uk!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ingo Thies Newsgroups: comp.graphics.apps.gnuplot Subject: Re: Fitting: How does gnuplot calculate the covariance matrix? Date: Sat, 16 Apr 2011 18:06:51 +0200 Lines: 48 Message-ID: <90tt4sFj9bU1@mid.individual.net> References: <9088euFi3iU1@mid.individual.net> <908n9pF2jaU1@mid.individual.net> <90e7s7F9faU1@mid.dfncis.de> <90h3ttF39uU1@mid.individual.net> <4DA3725D.3040306@t-online.de> <90ik9hF7p0U1@mid.individual.net> <90rtluF8muU1@mid.dfncis.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net iru+/9nU6huEnty4ROPaYAuc4+flAB/2TTWE3fW+5hDreFHaA6 Cancel-Lock: sha1:fYJBRad7GP0HFWdKnhVQGggkpDc= User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: <90rtluF8muU1@mid.dfncis.de> Xref: x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:270 Am 2011-04-16 00:03, schrieb Hans-Bernhard Bröker: > Where do you think I did anything arbitrary? The assumption that the largest a (i.e. a+a_err) corresponds to the largest b (b+b_err) is arbitrary and actually wrong if the a,b are anticorrelated. Rather, if b_max=b+b_err is given, the corresponding a' is minimizing chi^2 for this condition (see Numerical Recipes in C/Fortran, Chapter 15.6). This can be done by following the 68.3%-probability ("1 sigma") contour until b becomes maximal. If anticorrelated, a' will be closer to a-a_err rather than a or even a+a_err. My own fault just was to pick the wrong degree of freedom (dfree). While the goodness-of-fit estimation requires dfree=ndata-npar (=21-2=19 in our example), the confidence ellipse for combined (a,b) needs dfree=npar=2, and for separate a and b errors, dfree=1. Then the ellipses (or, more generally, contours, since they are not necessarily perfect ellipses) are smaller than the (a,b) confidence levels, but give you the position of an extreme parameter and its corresponding counterpart geometrically. If you have a copy of the Numerical Recipes in your library, Figure 15.6.4. gives a good illustration for what's going on. After correcting the degrees of freedom and redoing the fit for chi^2=ndata-npar, the errors are now nearly identical to those of gnuplot, at least, if the error contours are near-elliptical. If they're not (i.e. errors are not Gaussian), the errors are larger, but probably less meaningful. > Yes, that's what this particular model function does. That was your > choice, not mine. A different model, e.g. a*(x-x0), might yield a > different behaviour. If the error corridors are calculated by following the confidence ellipses, they are indeed independent from the choide of x0, although the best-fit a and its errors change. >> All (a,b) at small steps around the ellipse. > > A misunderstanding. I was asking: where in that ellipse did those > numbers your quote as errors of a and b come from? The extremal a-values minus a_bestfit are taken as a-errors, and the same with b. -- Gruß, Ingo