Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!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: Mon, 11 Apr 2011 21:42:53 +0200 Lines: 51 Message-ID: <90h3ttF39uU1@mid.individual.net> References: <9088euFi3iU1@mid.individual.net> <908n9pF2jaU1@mid.individual.net> <90e7s7F9faU1@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 JqfaBLscMhKp1sjZoHpkPgIuAHY1nUCYxbTPDDJzyXWVXqyZCM Cancel-Lock: sha1:okDMXLcbzd1RlSqgSQO5cPuZI7c= 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: <90e7s7F9faU1@mid.dfncis.de> Xref: x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:234 Am 2011-04-10 19:31, schrieb Hans-Bernhard Bröker: >> 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: Well, I plotted the enveloping contours for all (a,b) sets on the 1-sigma contour, and found that the resulting two curves nicely embrace the majority of data points, and the "error pipe" is about the same size as the errorbars. And along this 1-sigma contour a and b walk through the error intervals above. In particular, the upper right figure in this poster has been created this way: Please note that the error pipe is based on the 1 and 2 sigma level corresponding to chi^2-chi_min^2 rather than chi^2 itself. > > [assuming 'set fit errorvar' active, and fit done:] > > gnuplot> p 'fit.dat' u 1:2:3 w err, a*x+b w l You mixed up a and b here; it is actually f(x)=a+b*x > 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. The problem hier is that a and b are anti-correlated (the correlation coefficient in the lower-left of the matrix is negative), i.e. the larges b corresponds to the smallest a and vice-versa. The only viable way to plot the error pipe (or corridor) is to use the actual (a,b) tuples from the 1 (or 2, 3 etc.) sigma contour. Or, at least, combine the largest a with the smallest b: [...] gnuplot> rep a+a_thies+(b-b_thies)*x, a-a_thies+(b+b_thies)*x -- Gruß, Ingo