Closed sbodorkos closed 1 year ago
Found the code with the minIndex condition at line 198 of WeightedMeanCalculators.java.
if (linReg && (minIndex > 0)) {
wtdLinCorrResults.setSlope(slopeW[minIndex]);
wtdLinCorrResults.setSigmaSlope(sigmaSlopeW[minIndex]);
wtdLinCorrResults.setCovSlopeInter(covSlopeInterW[minIndex]);
}
Will update and release a new version this week. Thanks for checking the details!
Thanks to Bill Davis (Geological Survey of Canada) for flagging this. He has processed data in both Squid3 and SQUID 2.50.20.10.26 (which is the "best match" to Squid3), and noted that spot-means are indistinguishable when Squid3 is used in 'spot-average' mode ("Wtd Mean" below), but quite different in 'linear regression' mode ("LR" below). In particular, the Squid3 LR uncertainties are significantly larger than the SQUID 2.50 LR uncertainties:
Bill suggested that it might be a manifestation of this problem (this is a slide from my Squid3 Launch PowerPoint):
I have reviewed both sets of code, and I think he might be right. At some point, the "midpoint vs intercept" issue was addressed in SQUID 2.50: the 26 October 2020 version contains the amended code:
which calculates Slope, SigmaSlope and CovSlopeInter whenever LinReg = TRUE (regardless of MinIndex).
In contrast, the corresponding code documentation for Squid3 (see https://github.com/CIRDLES/ET_Redux/wiki/SHRIMP:-Sub-WtdLinCorr, right at the bottom) looks like this:
It appears that the MinIndex-related criterion was flagged for follow-up, but this line of code was never changed in Squid3. My guess is we never picked this up previously because we have never done a cell-by-cell comparison (for data calculated via linear regression) since the SQUID 2.50 change was enacted.
Jim @bowring , could you please review the Squid3 code corresponding to the yellow line, and modify if needed? It should simply read "If LinReg = TRUE". When we have a new version, I will ask Bill to re-test.
If that line of code is not the issue (i.e. if it already just reads "If LinReg = TRUE"), then we will need to dig deeper. Please let me know.