Rename ConfidenceInterval to Interval
This commit is contained in:
parent
0f63b7eb40
commit
239a0646d2
@ -19,8 +19,8 @@ In determining whether there is *nan* in the data, only the columns specified in
|
|||||||
General result classes
|
General result classes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
.. autoclass:: yli.utils.ConfidenceInterval
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. autoclass:: yli.utils.Estimate
|
.. autoclass:: yli.utils.Estimate
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
.. autoclass:: yli.utils.Interval
|
||||||
|
:members:
|
||||||
|
@ -18,7 +18,7 @@ import numpy as np
|
|||||||
from scipy import integrate, optimize, stats
|
from scipy import integrate, optimize, stats
|
||||||
|
|
||||||
from .config import config
|
from .config import config
|
||||||
from .utils import ConfidenceInterval
|
from .utils import Interval
|
||||||
|
|
||||||
class betarat_gen(stats.rv_continuous):
|
class betarat_gen(stats.rv_continuous):
|
||||||
"""
|
"""
|
||||||
@ -343,7 +343,7 @@ def hdi(distribution, level=None):
|
|||||||
:param level: Coverage/confidence probability, default (*None*) is 1 − *config.alpha*
|
:param level: Coverage/confidence probability, default (*None*) is 1 − *config.alpha*
|
||||||
:type level: float
|
:type level: float
|
||||||
|
|
||||||
:rtype: :class:`yli.utils.ConfidenceInterval`
|
:rtype: :class:`yli.utils.Interval`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if level is None:
|
if level is None:
|
||||||
@ -363,4 +363,4 @@ def hdi(distribution, level=None):
|
|||||||
width = optimize_result.fun
|
width = optimize_result.fun
|
||||||
upper_limit = lower_limit + width
|
upper_limit = lower_limit + width
|
||||||
|
|
||||||
return ConfidenceInterval(lower_limit, upper_limit)
|
return Interval(lower_limit, upper_limit)
|
||||||
|
@ -23,7 +23,7 @@ import functools
|
|||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from .config import config
|
from .config import config
|
||||||
from .utils import ConfidenceInterval, Estimate, PValueStyle, as_2groups, check_nan, convert_pandas_nullable, fmt_p
|
from .utils import Estimate, Interval, PValueStyle, as_2groups, check_nan, convert_pandas_nullable, fmt_p
|
||||||
|
|
||||||
# ----------------
|
# ----------------
|
||||||
# Student's t test
|
# Student's t test
|
||||||
@ -268,13 +268,13 @@ class MannWhitneyResult:
|
|||||||
self.med1 = med1
|
self.med1 = med1
|
||||||
#: Median of the second group (*float*)
|
#: Median of the second group (*float*)
|
||||||
self.med2 = med2
|
self.med2 = med2
|
||||||
#: Interquartile range of the first group (:class:`yli.utils.ConfidenceInterval`)
|
#: Interquartile range of the first group (:class:`yli.utils.Interval`)
|
||||||
self.iqr1 = iqr1
|
self.iqr1 = iqr1
|
||||||
#: Interquartile range of the second group (:class:`yli.utils.ConfidenceInterval`)
|
#: Interquartile range of the second group (:class:`yli.utils.Interval`)
|
||||||
self.iqr2 = iqr2
|
self.iqr2 = iqr2
|
||||||
#: Range of the first group (:class:`yli.utils.ConfidenceInterval`)
|
#: Range of the first group (:class:`yli.utils.Interval`)
|
||||||
self.range1 = range2
|
self.range1 = range2
|
||||||
#: Range of the second group (:class:`yli.utils.ConfidenceInterval`)
|
#: Range of the second group (:class:`yli.utils.Interval`)
|
||||||
self.range2 = range2
|
self.range2 = range2
|
||||||
|
|
||||||
#: Absolute value of the rank-biserial correlation (*float*)
|
#: Absolute value of the rank-biserial correlation (*float*)
|
||||||
@ -438,7 +438,7 @@ def mannwhitney(df, dep, ind, *, nan_policy='warn', brunnermunzel=True, use_cont
|
|||||||
return MannWhitneyResult(
|
return MannWhitneyResult(
|
||||||
statistic=min(u1, u2), pvalue=result.pvalue,
|
statistic=min(u1, u2), pvalue=result.pvalue,
|
||||||
group1=group1, group2=group2,
|
group1=group1, group2=group2,
|
||||||
med1=data1.median(), med2=data2.median(), iqr1=ConfidenceInterval(data1.quantile(0.25), data1.quantile(0.75)), iqr2=ConfidenceInterval(data2.quantile(0.25), data2.quantile(0.75)), range1=ConfidenceInterval(data1.min(), data1.max()), range2=ConfidenceInterval(data2.min(), data2.max()),
|
med1=data1.median(), med2=data2.median(), iqr1=Interval(data1.quantile(0.25), data1.quantile(0.75)), iqr2=Interval(data2.quantile(0.25), data2.quantile(0.75)), range1=Interval(data1.min(), data1.max()), range2=Interval(data2.min(), data2.max()),
|
||||||
rank_biserial=r, direction=('{1} > {0}' if u1 < u2 else '{0} > {1}').format(group1, group2))
|
rank_biserial=r, direction=('{1} > {0}' if u1 < u2 else '{0} > {1}').format(group1, group2))
|
||||||
|
|
||||||
# ------------------------
|
# ------------------------
|
||||||
|
10
yli/utils.py
10
yli/utils.py
@ -228,13 +228,13 @@ def fmt_p(p, style):
|
|||||||
# ------------------------------
|
# ------------------------------
|
||||||
# General result-related classes
|
# General result-related classes
|
||||||
|
|
||||||
class ConfidenceInterval:
|
class Interval:
|
||||||
"""A confidence interval"""
|
"""An interval (e.g. confidence interval)"""
|
||||||
|
|
||||||
def __init__(self, lower, upper):
|
def __init__(self, lower, upper):
|
||||||
#: Lower confidence limit (*float*)
|
#: Lower limit (*float*)
|
||||||
self.lower = lower
|
self.lower = lower
|
||||||
#: Upper confidence limit (*float*)
|
#: Upper limit (*float*)
|
||||||
self.upper = upper
|
self.upper = upper
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@ -247,7 +247,7 @@ class ConfidenceInterval:
|
|||||||
|
|
||||||
def summary(self):
|
def summary(self):
|
||||||
"""
|
"""
|
||||||
Return a stringified summary of the confidence interval
|
Return a stringified summary of the interval
|
||||||
|
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user