pyab_experiment.utils.stats#
Binomial CI estimates
Module Contents#
Functions#
|
Return the mean and the confidence interval of Bernoulli trials. |
|
Compute the probit of a given value. |
- pyab_experiment.utils.stats.confidence_interval(n: int = 10, p: float = 0.5, confidence: float = 0.95, method: str = 'agresti-coull') tuple[float, float][source]#
Return the mean and the confidence interval of Bernoulli trials. See `https://en.wikipedia.org/wiki/Binomial_distribution#Confidence_intervals`_
- pyab_experiment.utils.stats.probit(alpha: float = 0.5) float[source]#
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.
- Parameters:
alpha (float) – The probability value for which to compute the probit. Default is 0.5, which corresponds to the median of the standard normal distribution.
- Returns:
The probit value corresponding to the input probability.
- Return type:
float
Note
See `https://en.wikipedia.org/wiki/Probit for the approximation`_ of using the logit function.
Examples
>>> probit(0.5) 0.0 >>> probit(0.975) 1.959963984540054