Recent changes to 654: Add option covariancevariables to set fit and minor fit changeshttp://sourceforge.net/p/gnuplot/patches/654/2014-06-20T07:36:21Z#654 Add option covariancevariables to set fit and minor fit changes2014-06-20T07:36:21Z2014-06-20T07:36:21ZAlexander Täschnerhttp://sourceforge.net/u/taschna/http://sourceforge.net062e2ebfdca807d0ecdb2990b0321e5c284759d4<div class="markdown_content"><p>In the attached patch I added a new overwrite option to the update command,<br />
so that<br />
update 'test.par' overwrite<br />
will overwrite the backup file 'test.par.old', if it already exists.</p></div>#654 Add option covariancevariables to set fit and minor fit changes2014-03-10T06:58:24Z2014-03-10T06:58:24ZAlexander Täschnerhttp://sourceforge.net/u/taschna/http://sourceforge.net824e3189e4b8b88cc0b9354f9d873dbaeddd5f4d<div class="markdown_content"><blockquote>
<p>removal of the backup file in update: I might be wrong, but I think the idea was to <br />
preserve the original file in any case, not just in case of error.</p>
</blockquote>
<p>The problem of the old approach is, that it is not possible to run a script, which fits <br />
data and updates the parameter file, multiple times, since at the third time, the<br />
backup file already exists and the code errors out. One solution would be to generate<br />
a new file name in this case and the other (which I implemented) is to simply delete the<br />
backup file.</p></div>#654 Add option covariancevariables to set fit and minor fit changes2014-03-09T19:39:20Z2014-03-09T19:39:20ZBastian Märkischhttp://sourceforge.net/u/markisch/http://sourceforge.netc0429dc9937c2c6064ed0217975a7858ee659dc5<div class="markdown_content"><ul>
<li><strong>status</strong>: pending --> pending-accepted</li>
</ul></div>#654 Add option covariancevariables to set fit and minor fit changes2014-03-09T19:38:55Z2014-03-09T19:38:55ZBastian Märkischhttp://sourceforge.net/u/markisch/http://sourceforge.net14d6f6b564d2437daf8033d1da69c551165d9333<div class="markdown_content"><p>Thanks for the feedback. The covar code is in CVS now. Your remaining changes are contained in the attached patch, to which I have a few comments:</p>
<ul>
<li>
<p>removal of the backup file in <code>update</code>: I might be wrong, but I think the idea was to preserve the original file in any case, not just in case of error.</p>
</li>
<li>
<p>ensure errors in data are larger than zero: There already is a code block further down which not only prints an error message, but also prints useful information about the current datapoint. It is marked by "/<em> tsm patchset 230: check for zero error values </em>/". Right now it only checks that z-errors are unequal zero, but that could easily be extended to "larger than". Now that gnuplot supports errors in the independent variables, we have to take care that some errors are actually allowed to be = 0 if more than one error column is given.</p>
</li>
<li>
<p>"data read from" line in fit.log: I think the inclusion of the <code>using</code> statement there was intentional and is actually useful. </p>
</li>
</ul></div>#654 Add option covariancevariables to set fit and minor fit changes2014-03-09T17:47:37Z2014-03-09T17:47:37ZEthan Merritthttp://sourceforge.net/u/sfeam/http://sourceforge.net982c16bf99c2ebea74fa8899a1adc129e118e8da<div class="markdown_content"><p>I agree with this. I don't often use gnuplot's fitting code because I have field-specific optimization programs that normally serve my needs. But in general what I want out the back end of optimization is the covariance matrix rather than correlations.</p></div>#654 Add option covariancevariables to set fit and minor fit changes2014-03-09T17:16:53Z2014-03-09T17:16:53ZAlexander Täschnerhttp://sourceforge.net/u/taschna/http://sourceforge.netfce96ec224bc4ba7b87393d103a5569c6834932b<div class="markdown_content"><blockquote>
<p>Could you please detail your envisaged usage? Since we already print the correlation <br />
matrix, wouldn't it be better to save this instead of the covariance matrix?</p>
</blockquote>
<p>I use the code for the calculation of error propagation in cases where no fit function<br />
could be found that has small correlation of the fit parameters. In this usage the<br />
covariances are needed and I found it easier to provide them directly instead of looking<br />
up the formula to calculate it from the correlation matrix.</p></div>#654 Add option covariancevariables to set fit and minor fit changes2014-03-09T16:57:15Z2014-03-09T16:57:15ZBastian Märkischhttp://sourceforge.net/u/markisch/http://sourceforge.net0387d19a909e7337ec80f08e9c5ff8009c658c07<div class="markdown_content"><ul>
<li><strong>status</strong>: open --> pending</li>
<li><strong>assigned_to</strong>: Bastian Märkisch</li>
</ul></div>#654 Add option covariancevariables to set fit and minor fit changes2014-03-09T15:11:34Z2014-03-09T15:11:34ZBastian Märkischhttp://sourceforge.net/u/markisch/http://sourceforge.net20913e32231848aa8050f9af5fb21d205f951081<div class="markdown_content"><p>The <code>print_function_definitions</code> addition is in CVS. Since recursion is actually allowed, I changed your code in order to just stop and print a message after a certain number of recursion levels instead of bailing out. Also, I removed duplicates from the output and limited the number of printed functions definitions to a reasonable (32) number.</p>
<p>Please find attached a revised version of your covar patch which applies to current CVS. Instead of cluttering the user variable name space, results are now prefixed with "FIT_COVAR_". All variables named "FIT_COVAR_*" are removed at the start of a new fit command.</p>
<p>Could you please detail your envisaged usage? Since we already print the correlation matrix, wouldn't it be better to save this instead of the covariance matrix?</p>
<p>Btw. please note that most of gnuplot's source uses a tab size of 8 and indentation of 4.</p></div>#654 Add option covariancevariables to set fit and minor fit changes2014-03-04T20:54:41Z2014-03-04T20:54:41ZBastian Märkischhttp://sourceforge.net/u/markisch/http://sourceforge.netc379715ee9cc9f8efeb49dcc004d433a51b96a20<div class="markdown_content"><ul>
<li><strong>labels</strong>: --> fit</li>
<li><strong>Group</strong>: --> </li>
</ul></div>Add option covariancevariables to set fit and minor fit changes2014-03-04T14:04:19Z2014-03-04T14:04:19ZAlexander Täschnerhttp://sourceforge.net/u/taschna/http://sourceforge.netc268f4c14b1369137ea9f86c847e34da9ae298b5<div class="markdown_content"><p>The attached patch adds the option covariancevariables to set fit. If enabled, this<br />
leads to the generation of user-defined variables which contain the entries of the<br />
covariance matrix. For a fit with the parameters "a" and "b" this leads to the<br />
following four variables: "cov_a_a"="a_err"^2, "cov_a_b" = "cov_b_a", and<br />
"cov_b_b"="b_err"^2.</p>
<p>Furthermore this patch changes the calculation of the FIT_STDFIT variable in case<br />
errorscaling is switched off and z-errors (sigma_i) are provided. In the help file this<br />
variable is defined as "calculated standard deviation of the fit", but this<br />
is only equal to sqrt(chisq/ndf), if the weights are one. Otherwise this is given<br />
by sqrt(chisq/ndf*), where is the weighted average of the individual variances: = 1/(\sum(1/sigma_i^2)/N). This formula is now implemented.</p>
<p>The chi-square and reduced chi-square values are now provided as user-defined variables<br />
FIT_CHISQ and FIT_REDCHISQ.</p></div>