Rename ConfidenceInterval to Interval

This commit is contained in:
RunasSudo 2022-11-09 22:10:15 +11:00
parent 0f63b7eb40
commit 239a0646d2
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
4 changed files with 17 additions and 17 deletions

View File

@ -19,8 +19,8 @@ In determining whether there is *nan* in the data, only the columns specified in
General result classes
----------------------
.. autoclass:: yli.utils.ConfidenceInterval
:members:
.. autoclass:: yli.utils.Estimate
:members:
.. autoclass:: yli.utils.Interval
:members:

View File

@ -18,7 +18,7 @@ import numpy as np
from scipy import integrate, optimize, stats
from .config import config
from .utils import ConfidenceInterval
from .utils import Interval
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*
:type level: float
:rtype: :class:`yli.utils.ConfidenceInterval`
:rtype: :class:`yli.utils.Interval`
"""
if level is None:
@ -363,4 +363,4 @@ def hdi(distribution, level=None):
width = optimize_result.fun
upper_limit = lower_limit + width
return ConfidenceInterval(lower_limit, upper_limit)
return Interval(lower_limit, upper_limit)

View File

@ -23,7 +23,7 @@ import functools
import warnings
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
@ -268,13 +268,13 @@ class MannWhitneyResult:
self.med1 = med1
#: Median of the second group (*float*)
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
#: Interquartile range of the second group (:class:`yli.utils.ConfidenceInterval`)
#: Interquartile range of the second group (:class:`yli.utils.Interval`)
self.iqr2 = iqr2
#: Range of the first group (:class:`yli.utils.ConfidenceInterval`)
#: Range of the first group (:class:`yli.utils.Interval`)
self.range1 = range2
#: Range of the second group (:class:`yli.utils.ConfidenceInterval`)
#: Range of the second group (:class:`yli.utils.Interval`)
self.range2 = range2
#: 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(
statistic=min(u1, u2), pvalue=result.pvalue,
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))
# ------------------------

View File

@ -228,13 +228,13 @@ def fmt_p(p, style):
# ------------------------------
# General result-related classes
class ConfidenceInterval:
"""A confidence interval"""
class Interval:
"""An interval (e.g. confidence interval)"""
def __init__(self, lower, upper):
#: Lower confidence limit (*float*)
#: Lower limit (*float*)
self.lower = lower
#: Upper confidence limit (*float*)
#: Upper limit (*float*)
self.upper = upper
def __repr__(self):
@ -247,7 +247,7 @@ class ConfidenceInterval:
def summary(self):
"""
Return a stringified summary of the confidence interval
Return a stringified summary of the interval
:rtype: str
"""