Skip to content

clarify meaning of xbar and mu in pvariance/variance of statistics module #64588

Closed

Description

@jtaylor
mannequin
BPO 20389
Nosy @ncoghlan, @stevendaprano, @iritkatriel
Files
  • issue20389_statistics_docs.diff: Module docs patch
  • 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 = None
    created_at = <Date 2014-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 = <Date 2021-08-20.10:12:17.443>
    user = 'https://bugs.python.org/jtaylor'

    bugs.python.org fields:

    activity = <Date 2021-08-20.10:12:17.443>
    actor = 'iritkatriel'
    assignee = 'steven.daprano'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2014-01-25.12:37:20.207>
    creator = 'jtaylor'
    dependencies = []
    files = ['33990']
    hgrepos = []
    issue_num = 20389
    keywords = ['patch', 'easy']
    message_count = 5.0
    messages = ['209192', '209193', '210119', '210605', '399953']
    nosy_count = 5.0
    nosy_names = ['ncoghlan', 'steven.daprano', 'jtaylor', 'oscarbenjamin', 'iritkatriel']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue20389'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Linked PRs

    Activity

    1. jtaylor commented on Jan 25, 2014

      jtaylormannequin
      MannequinAuthor

      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.

    2. jtaylor commented on Jan 25, 2014

      jtaylormannequin
      MannequinAuthor

      xbar is the *sample* mean of course

      maybe with proper docstrings the two functions could also use the same keyword argument?

    3. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Jan 28, 2014
    4. self-assigned this
      on Feb 2, 2014
    5. oscarbenjamin commented on Feb 3, 2014

      oscarbenjaminmannequin
      Mannequin

      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

    6. ncoghlan commented on Feb 8, 2014

      @ncoghlan
      Contributor

      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).

    7. iritkatriel commented on Aug 20, 2021

      @iritkatriel
      Member

      I've closed bpo-36099 as a duplicate of this.

    8. transferred this issue fromon Apr 10, 2022
    9. added a commit that references this issue on Mar 28, 2024
    10. added a commit that references this issue on Apr 19, 2024
    11. added a commit that references this issue on Apr 19, 2024
    12. added a commit that references this issue on Apr 19, 2024
    13. savannahostrowski commented on May 9, 2024

      @savannahostrowski
      Member

      This can be closed now, right? Looks like both #117333 and #118080 were merged

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.10 (EOL)end of life3.11only security fixes3.9 (EOL)end of lifeeasystdlibStandard Library Python modules in the Lib/ directory

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions