From 239a0646d23e8eda3ca30bc357386d15bbc14d49 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Wed, 9 Nov 2022 22:10:15 +1100 Subject: [PATCH] Rename ConfidenceInterval to Interval --- docs/general.rst | 6 +++--- yli/distributions.py | 6 +++--- yli/sig_tests.py | 12 ++++++------ yli/utils.py | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/general.rst b/docs/general.rst index 0cdfc1a..d6eaf01 100644 --- a/docs/general.rst +++ b/docs/general.rst @@ -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: diff --git a/yli/distributions.py b/yli/distributions.py index cab6f0e..ad200a9 100644 --- a/yli/distributions.py +++ b/yli/distributions.py @@ -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) diff --git a/yli/sig_tests.py b/yli/sig_tests.py index c24982e..9fa6489 100644 --- a/yli/sig_tests.py +++ b/yli/sig_tests.py @@ -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)) # ------------------------ diff --git a/yli/utils.py b/yli/utils.py index 6813ca8..d413f3f 100644 --- a/yli/utils.py +++ b/yli/utils.py @@ -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 """