:py:mod:`pyab_experiment.utils.stats`
=====================================

.. py:module:: pyab_experiment.utils.stats

.. autoapi-nested-parse::

   Binomial CI estimates



Module Contents
---------------


Functions
~~~~~~~~~

.. autoapisummary::

   pyab_experiment.utils.stats.confidence_interval
   pyab_experiment.utils.stats.probit



.. py:function:: confidence_interval(n: int = 10, p: float = 0.5, confidence: float = 0.95, method: str = 'agresti-coull') -> tuple[float, float]

   Return the mean and the confidence interval of Bernoulli trials.
   See `https://en.wikipedia.org/wiki/Binomial_distribution#Confidence_intervals`_


.. py:function:: probit(alpha: float = 0.5) -> float

   Compute the probit of a given value.

   The probit function is the inverse of the cumulative distribution function
   (CDF) of the standard normal distribution. It maps a probability (between 0
   and 1) to a corresponding value  on the real number line.

   :param alpha: The probability value for which to compute the probit.
                 Default is 0.5, which corresponds to the median of the standard
                 normal distribution.
   :type alpha: float

   :returns: The probit value corresponding to the input probability.
   :rtype: float

   .. note::

      See `https://en.wikipedia.org/wiki/Probit for the approximation`_
      of using the logit function.

   .. rubric:: Examples

   >>> probit(0.5)
   0.0
   >>> probit(0.975)
   1.959963984540054


