Bug Report: Gnuplot printout bugs from the "fit" function

"Victor J. Slabinski" <[email protected]> Mon, 18 Jul 2011 19:33:57 +0000
Newsgroups gmane.comp.graphics.gnuplot.bugs
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------060601060403030602070509
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Dear Gnuplot,

      The title page of the gnuplot 4.4 manual says to send bug
reports to you.

      This Email reports some minor printout bugs from the gnuplot
"fit" function when using
gnuplot 4.4 patchlevel 3 (last modified March 2011) on a PC using
Red Hat Linux 2.6.18-238.12.1.e15 .

1) When a value range is given for a variable, 'fit.log' echoes
this information, but gives the wrong variable name.

2) In listing "degrees of freedom", "rms of residuals", and
"variance of residuals", an inconsistent variable name is used by
fit.log and by the terminal output.

The attached text files give a simple gnuplot script along with the
resulting output which illustrates the problems.

Victor J. Slabinski


-- 
===================================================================
Victor J. Slabinski              Phone:  202-762-0365
Earth Orientation Department     FAX:    202-762-1563
U.S. Naval Observatory           email:
3450 Massachusetts Ave. NW           [email protected]
Washington DC 20392-5420
===================================================================

--------------060601060403030602070509
Content-Type: text/plain;
 name="prob.demo.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="prob.demo.txt"

File with the
1) Gnuplot fit script
2) test.data (input data file)
3) output from terminal screen (with "NOTE"s inserted
   on two very minor irregularities (bugs)).
   The start of this item gives the GNUPLOT version
   used and the RedHat Linux version used for the
   operating system.

The "fit.log" illustrating the major complaint (Bug 1)
is in a separate file.



#  Gnuplot fit script                            rana:   lageos/fit_prog
set angles degrees
CC = 2.0
AMP= -.5
f1(PHI)=CC+AMP*sin(PHI)
fit [PHI=-1.:91.] f1(PHI) 'test.data' u 2:1:(1) via CC, AMP



test.data (input data file)

# f1      PHI
-2.0      90.
-1.5315   65.
 0.1321   35.
 2.5642    5.
 3.        0.



Output to terminal screen:

        G N U P L O T
        Version 4.4 patchlevel 3
        last modified March 2011
        System: Linux 2.6.18-238.12.1.el5

        Copyright (C) 1986-1993, 1998, 2004, 2007-2010
        Thomas Williams, Colin Kelley and many others

        gnuplot home:     http://www.gnuplot.info
        faq, bugs, etc:   type "help seeking-assistance"
        immediate help:   type "help"
        plot window:      hit 'h'

Terminal type set to 'x11'

.                             ****************************************
gnuplot> load 'fit_prog    <--NOTE: load works without closing quote(')
.                             ****************************************


 Iteration 0
 WSSR        : 25.5955           delta(WSSR)/WSSR   : 0
 delta(WSSR) : 0                 limit for stopping : 1e-05
 lambda   : 0.846048

initial set of free parameter values

CC              = 2
AMP             = -0.5
/

 Iteration 1
 WSSR        : 3.56006           delta(WSSR)/WSSR   : -6.18964
 delta(WSSR) : -22.0355          limit for stopping : 1e-05
 lambda   : 0.0846048

resultant parameter values

CC              = 1.95023
AMP             = -2.94142
/

 Iteration 2
 WSSR        : 0.000413588       delta(WSSR)/WSSR   : -8606.73
 delta(WSSR) : -3.55964          limit for stopping : 1e-05
 lambda   : 0.00846048

resultant parameter values

CC              = 2.98726
AMP             = -4.97808
/

 Iteration 3
 WSSR        : 1.64543e-09       delta(WSSR)/WSSR   : -251355
 delta(WSSR) : -0.000413586      limit for stopping : 1e-05
 lambda   : 0.000846048

resultant parameter values

CC              = 2.99998
AMP             = -4.99997
/

 Iteration 4
 WSSR        : 1.64034e-09       delta(WSSR)/WSSR   : -0.00310448
 delta(WSSR) : -5.0924e-12       limit for stopping : 1e-05
 lambda   : 8.46048e-05

resultant parameter values

CC              = 2.99999
AMP             = -4.99997
*************************
After 5 iterations the fit converged.
final sum of squares of residuals : 1.64034e-09
rel. change during last iteration : 0



********************************************************************
Bug 2:  NOTE the text bug in the following three lines of output.
The first line defines the "degrees of freedom" variable as FIT_NDF;
the second and third lines use the notation "ndf" for this variable.
The same bug occurs in fit.log .
********************************************************************
degrees of freedom    (FIT_NDF)                        : 3
rms of residuals      (FIT_STDFIT) = sqrt(WSSR/ndf)    : 2.33833e-05
variance of residuals (reduced chisquare) = WSSR/ndf   : 5.46778e-10



Final set of parameters            Asymptotic Standard Error
=======================            ==========================

CC              = 2.99999          +/- 1.676e-05    (0.0005587%)
AMP             = -4.99997         +/- 2.551e-05    (0.0005103%)


correlation matrix of the fit parameters:

               CC     AMP    
CC              1.000 
AMP            -0.781  1.000 
gnuplot> q

--------------060601060403030602070509
Content-Type: text/plain;
 name="fit.log.demo.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="fit.log.demo.txt"

#!/bin/bash
fit.log - illustrating a major and a minor bug along with my comments
          on the two bugs.

*********************************************************************
Mon Jul 18 10:33:50 2011


FIT:    data read from 'test.data' u 2:1:(1)
        format = PHI:z:s

******************************************************
Bug 1:  NOTE: The following line in the log results from
the '[PHI=-1.:91.]' parameter in the fit command of the
gnuplot script.  But instead of labeling the variable
as 'PHI' (our name for the 'x' variable), the output
here calls it 'y'.  From other testing I find the name
is always one variable "off" [index error?] in the
standard x:y:t: etc. variable name sequence.
******************************************************
	y range restricted to [-1.00000 : 91.0000]


        #datapoints = 5
function used for fitting: f1(PHI)
fitted parameters initialized with current variable values



 Iteration 0
 WSSR        : 25.5955           delta(WSSR)/WSSR   : 0
 delta(WSSR) : 0                 limit for stopping : 1e-05
 lambda	  : 0.846048

initial set of free parameter values

CC              = 2
AMP             = -0.5

After 5 iterations the fit converged.
final sum of squares of residuals : 1.64034e-09
rel. change during last iteration : 0


********************************************************************
Bug 2:  NOTE the text bug in the following three lines of output.
The first line defines the "degrees of freedom" variable as FIT_NDF;
the second and third lines use the notation "ndf" for this variable.
The same bug occurs in the terminal output.
********************************************************************
degrees of freedom    (FIT_NDF)                        : 3
rms of residuals      (FIT_STDFIT) = sqrt(WSSR/ndf)    : 2.33833e-05
variance of residuals (reduced chisquare) = WSSR/ndf   : 5.46778e-10

Final set of parameters            Asymptotic Standard Error
=======================            ==========================

CC              = 2.99999          +/- 1.676e-05    (0.0005587%)
AMP             = -4.99997         +/- 2.551e-05    (0.0005103%)


correlation matrix of the fit parameters:

               CC     AMP    
CC              1.000 
AMP            -0.781  1.000 

--------------060601060403030602070509
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
--------------060601060403030602070509
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gnuplot-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gnuplot-bugs

--------------060601060403030602070509--