You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clarify meaning of xbar and mu in pvariance/variance of statistics module #64588
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/stevendaprano'closed_at=Nonecreated_at=<Date2014-01-25.12:37:20.207>labels= ['easy', 'library', '3.9', '3.10', '3.11']
title='clarify meaning of xbar and mu in pvariance/variance of statistics module'updated_at=<Date2021-08-20.10:12:17.443>user='https://bugs.python.org/jtaylor'
the pvariance and variance functions take the argument mu and xbar to pass the population and sample mean to avoid some recomputation.
I assume the keyword arguments are different because the two means accepted are different, but the docstring does not indicate this directly.
It just says mu or xbar is the mean of the data. The module documentation is a little clearer but only in the grey box right at the end.
I would propose to change the docstring and module documentation to explicitly state that mu is the population mean and xbar is the population mean.
E.g.
The optional argument mu, if given, should be the mean of
the data.
+ The optional argument mu, if given, should be the population mean of
the data.
etc.
jtaylor commented on Jan 25, 2014
jtaylormannequin
MannequinAuthor
More actions
xbar is the *sample* mean of course
maybe with proper docstrings the two functions could also use the same keyword argument?
I agree that the current wording in the doc-strings is ambiguous. It should be more careful to distinguish between
mu : true/population mean
xbar : estimated/sample mean
I disagree that the keyword arguments should be made the same. There is an important conceptual difference between these two things that the user needs to be aware of and mu, xbar - as symbols rather than ascii characters - are widely used for this. See e.g. this Wikipedia entry (although it uses ybar instead of xbar): http://en.wikipedia.org/wiki/Variance#Population_variance
Steven included some draft docs updates in a separate patch for bpo-20481 - I have split those out and uploaded them here (since this discussion refers to the docstrings as well).
Activity
jtaylor commentedon Jan 25, 2014
the pvariance and variance functions take the argument mu and xbar to pass the population and sample mean to avoid some recomputation.
I assume the keyword arguments are different because the two means accepted are different, but the docstring does not indicate this directly.
It just says mu or xbar is the mean of the data. The module documentation is a little clearer but only in the grey box right at the end.
I would propose to change the docstring and module documentation to explicitly state that mu is the population mean and xbar is the population mean.
E.g.
the data.
+ The optional argument mu, if given, should be the population mean of
the data.
etc.
jtaylor commentedon Jan 25, 2014
xbar is the *sample* mean of course
maybe with proper docstrings the two functions could also use the same keyword argument?
oscarbenjamin commentedon Feb 3, 2014
I agree that the current wording in the doc-strings is ambiguous. It should be more careful to distinguish between
mu : true/population mean
xbar : estimated/sample mean
I disagree that the keyword arguments should be made the same. There is an important conceptual difference between these two things that the user needs to be aware of and mu, xbar - as symbols rather than ascii characters - are widely used for this. See e.g. this Wikipedia entry (although it uses ybar instead of xbar):
http://en.wikipedia.org/wiki/Variance#Population_variance
ncoghlan commentedon Feb 8, 2014
Steven included some draft docs updates in a separate patch for bpo-20481 - I have split those out and uploaded them here (since this discussion refers to the docstrings as well).
iritkatriel commentedon Aug 20, 2021
I've closed bpo-36099 as a duplicate of this.
pythongh-64588: Clarify the difference between mu and xbar in statist…
gh-64588: Clarify the difference between mu and xbar in statistics do…
pythongh-64588: Clarify the difference between mu and xbar in statist…
[3.12] gh-64588: Clarify the difference between mu and xbar in statis…
savannahostrowski commentedon May 9, 2024
This can be closed now, right? Looks like both #117333 and #118080 were merged