Created attachment 141741 [details] Sample data I'm trying to obtain the uncertainty in the determination of the slope in a linear regression analysis of some data. This sigma slope value is calculated in LibreOffice as if the line intersects the (0,0) value (b=0 in y=mx+b), regardless of what the "b" value is. Here's where this value is actually calculated: https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr5.cxx#2464 I'm attaching a ODS spreadsheet as an example.
Hello, please could you specify which formulas are wrong a what are expected values? I compared values from range B35:C39 (only here I see function linest) with excel and the values are the same. Thank you
(In reply to raal from comment #1) > Hello, please could you specify which formulas are wrong a what are expected > values? I compared values from range B35:C39 (only here I see function > linest) with excel and the values are the same. Thank you I've already tried in Excel and it's also wrong. The expected value for the variance of sigma_slope should be (J52)^2, not B36^2. M52^2 is the variance of sigma_slope calculated step by step, assuming the intercept with the Y-axis is zero. As can be seen, the LINEST function is returning the statistic sigma_slope as if the intercept with the Y-axis is zero, which, in this case, isn't zero (close, but not zero). The link in the OP points to the source code where that value is calculated, and apparently it's wrong.
(In reply to Pablo Wagner from comment #2) > (In reply to raal from comment #1) > > Hello, please could you specify which formulas are wrong a what are expected > > values? I compared values from range B35:C39 (only here I see function > > linest) with excel and the values are the same. Thank you > > I've already tried in Excel and it's also wrong. > > The expected value for the variance of sigma_slope should be (J52)^2, not > B36^2. M52^2 is the variance of sigma_slope calculated step by step, > assuming the intercept with the Y-axis is zero. As can be seen, the LINEST > function is returning the statistic sigma_slope as if the intercept with the > Y-axis is zero, which, in this case, isn't zero (close, but not zero). > > The link in the OP points to the source code where that value is calculated, > and apparently it's wrong. The expected value for the variance of the slope should be (J52)^2, not B36^2. M52^2 is the variance of the slope calculated step by step, assuming the intercept with the Y-axis is zero. As can be seen, the LINEST function is returning the statistic sigma_slope as if the intercept with the Y-axis is zero, which, in this case, isn't zero (close, but not zero). EDITED: Wrong quantity (variance sigma_slope isn't right)
Winfried, maybe you're interested.
Find the definition of the function LINEST at http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#LINEST.
(In reply to Regina Henschel from comment #5) > Find the definition of the function LINEST at > http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2. > html#LINEST. Everything seems OK there. But still, fSigmaSlope = fRMSE / sqrt(fSumX2) is wrong, since it's not giving the right value. According to the specs in the link provided, sigma_slope should be S_m as in: http://pages.mtu.edu/~fmorriso/cm3215/UncertaintySlopeInterceptOfLeastSquaresFit.pdf page 5 (quick Google search).
OK, I'm really ashamed. I forgot to fix the cell with the intercept parameter where I calculated the residuals. So, it was being set equal to zero for everything but the first term. I'm closing this bug report as INVALID. Sorry for wasting your time. Thanks.