This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients iritkatriel, mark.dickinson, reed, rhettinger, steven.daprano, xtreak
Date 2021-08-26.08:21:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629966071.84.0.756903553498.issue39218@roundup.psfhosted.org>
In-reply-to
Content
> The rounding correction in _ss() looks mathematically incorrect to me [...]

I don't think it was intended as a rounding correction - I think it's just computing the variance (prior to the division by n or n-1) of the `(x - c)` terms using the standard "expectation of x^2 - (expectation of x)^2" formula:

  sum((x - c)**2 for x in data) - (sum(x - c for x in data)**2) / n

So I guess it *can* be thought of as a rounding correction, but what it's correcting for is an inaccurate value of "c"; it's not correcting for inaccuracies in the subtraction results. That is, if you were to add an artificial error into c at some point before computing "total" and "total2", that correction term should take you back to something approaching the true sum of squares of deviations.

So mathematically, I think it's correct, but not useful, because mathematically "total2" will be zero. Numerically, it's probably not helpful.
History
Date User Action Args
2021-08-26 08:21:11mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, steven.daprano, xtreak, reed, iritkatriel
2021-08-26 08:21:11mark.dickinsonsetmessageid: <1629966071.84.0.756903553498.issue39218@roundup.psfhosted.org>
2021-08-26 08:21:11mark.dickinsonlinkissue39218 messages
2021-08-26 08:21:11mark.dickinsoncreate