Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/issue 1739 #1761

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/cogent3/maths/stats/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
ndtri,
)

from cogent3.util import warning as c3warn

# ndtri import b/c it should be available via this module

Expand All @@ -37,7 +38,9 @@ def zprob(x):
"""Returns both tails of z distribution (-inf to -x, inf to x)."""
return 2 * norm.sf(abs(x))


@c3warn.deprecated_callable(
version="2024.9", reason="use scipy.stats.t.sf() instead", is_discontinued=True
)
def tprob(x, df):
"""Returns both tails of t distribution (-infinity to -x, infinity to x)"""
return 2 * t.sf(abs(x), df)
Expand Down
13 changes: 1 addition & 12 deletions src/cogent3/maths/stats/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from scipy.stats import binom, f, norm, t
from scipy.stats.distributions import chi2

from cogent3.maths.stats.distribution import fprob, ndtri, tprob, zprob
from cogent3.maths.stats.distribution import fprob, ndtri, zprob
from cogent3.maths.stats.kendall import kendalls_tau, pkendall
from cogent3.maths.stats.ks import pkstwo, psmirnov2x
from cogent3.maths.stats.number import NumberCounter
Expand Down Expand Up @@ -1239,17 +1239,6 @@ def z_tailed_prob(z, tails):
return zprob(z)


def t_tailed_prob(x, df, tails):
"""Return appropriate p-value for given t and df, depending on tails."""
tails = tails or "2"
tails = _get_alternate(str(tails))

if tails == ALT_HIGH:
return t.sf(x, df)
elif tails == ALT_LOW:
return t.cdf(x, df)
else:
return tprob(x, df)


def reverse_tails(tails):
Expand Down
Loading