https://bugs.kde.org/show_bug.cgi?id=516992

            Bug ID: 516992
           Summary: In LabPlot, the errors in the fit parameters are
                    calculated incorrectly when the data have specified
                    weights.
    Classification: Applications
           Product: LabPlot2
      Version First 2.12.1
       Reported In:
          Platform: Other
                OS: Microsoft Windows
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Analysis
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 190284
  --> https://bugs.kde.org/attachment.cgi?id=190284&action=edit
An Excel file with columns of data for (x, y, err-y)

***
If you're not sure this is actually a bug, instead post about it at
https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see
https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY
A simple example of LabPlot's incorrect calculation of errors in fit parameters
is the case of equal weights for each data point. For data being fit to the
linear equation y(x) = a + bx, Bevington and Robinson (3rd ed.) give the
results for sigma_a and sigma_b in eq. 6.23 on p. 110, and these values clearly
depend on the value of sigma, the error in each measurement of y. Although eqn.
6.13 shows that the values of a and b themselves do NOT depend on the error in
y, the errors in a and b clearly DO depend on the error in y.  I suspect that
LabPlot also does an incorect calculation for the errors in the fit parameters
when the weights differ for each data point.  And it seems likely that this
problem exists for user-defined custom fit functions as well. Interestingly,
LabPlot does the calculation of the chi-squared and reduced chi-squared values
correctly.

This is unfortunate, because I thought I could use LabPlot as a helpful tool in
my data analysis course for physics students. I had previously used IGOR Pro,
which does this error calculation correctly. For now I will have to return to
IGOR Pro in order to obtain correct error values. Can this be fixed? It should
be a rather straightforward modification of the equations used to find these
errors.


STEPS TO REPRODUCE
1. Import the Excel data file I have included
2. Do a linear fit with the y-error value of 18.5 as given in the data file.
Choose weight = 1/col^2.
3. Inspect the errors in a and b.
4. Change 18.5 to 22 for all data points.
5. Re-run the linear fit.

OBSERVED RESULT
You'll notice that the a and b values are unchanged, which is expected.
However, the sigma_a and sigma_b values are ALSO unchanged, which is incorrect.

EXPECTED RESULT
The values for the errors in a and b should change when the error values in y
change.


SOFTWARE/OS VERSIONS
Windows: 11 (Education)
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to