Probability to stars utility

Open
#4,258 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start in statsmodels/tools/tools.py, the location proposed in the issue, and inspect nearby utility conventions and tests. Confirm the intended significance thresholds and boundary behavior from the provided function, then verify the utility through the relevant tools test suite; the issue is complete when the addition is accepted and covered by tests.

Written by the indexing model from the issue text.

Description

Would this be a fitting addition to this library? Equivalent to R's representation of significance stars.

I think statsmodels/tools/tools.py would be a good place for it but do let me know if there is a more fitting location.

I can make a PR if it is an appreciated addition.

def pvalue_to_stars(p):
    """
    Represent a p-value's significance with stars.

    Parameters
    ----------
    p : float

    Returns
    -------
    str
        Representation of the p-value's significance.

    """
    if not 0 <= p <= 1:
        raise ValueError('p must be in range [0, 1]')

    if p <= 0.0001:
        return '****'
    elif p <= 0.001:
        return '***'
    elif p <= 0.01:
        return '**'
    elif p <= 0.05:
        return '*'
    else:
        return ''
Dominant language
Python
Stars
11.6k
Forks
3.6k
Avg merge
7h 37m
Merged PRs (30d)
96

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from statsmodels/statsmodels

All issues in statsmodels/statsmodels

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.