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 rhettinger
Recipients Folket, rhettinger, steven.daprano
Date 2020-06-03.16:45:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1591202719.5.0.748119098476.issue40855@roundup.psfhosted.org>
In-reply-to
Content
The relevant code is in the _ss() helper function:

    # The following sum should mathematically equal zero, but due to rounding
    # error may not.
    U, total2, count2 = _sum((x-c) for x in data)
    assert T == U and count == count2
    total -=  total2**2/len(data)

The intent was to correct for small rounding errors, but the effect is to undo any xbar value that differs from the true mean.

From a user point-of-view the xbar parameter should have two effects, saving the computation time for the mean and also giving the ability to recenter the stdev/variance around a different point.   It does save a call to mean; however, that effort is mostly throw-away by the rounding adjustment code which does even more work than computing the mean.

Likely, the fix for this is skip the rounding adjustment code if the user supplies an xbar value.
History
Date User Action Args
2020-06-03 16:45:19rhettingersetrecipients: + rhettinger, steven.daprano, Folket
2020-06-03 16:45:19rhettingersetmessageid: <1591202719.5.0.748119098476.issue40855@roundup.psfhosted.org>
2020-06-03 16:45:19rhettingerlinkissue40855 messages
2020-06-03 16:45:19rhettingercreate