binoinv
Binomial inverse cumulative distribution function
Syntax
Description
returns the smallest integer x
= binoinv(y
,n
,p
)x
such that the binomial cdf evaluated at
x
is equal to or greater than y
. You can think
of y
as the probability of observing x
successes
in n
independent trials where p
is the probability
of success in each trial. Each value in x
is a positive integer less
than or equal to n
.
Examples
Input Arguments
Output Arguments
Algorithms
The software uses various methods to approximate the inverse of the binomial cumulative distribution function:
It applies an asymptotic inversion using the complementary error function under valid conditions specified in [1].
For values of
n
greater than or equal to 20 andp
less than or equal to 0.05, a Poisson approximation is used if the asymptotic method is not suitable.If neither of the previous methods are applicable, the software uses the Cornish-Fisher [2] expansion truncated at the first order to include skewness.
After computing the approximate inverse, the software finds the exact inverse by searching in the vicinity of the approximated value.
References
[1] Gil, A., J. Segura, and N. M. Temme. “Asymptotic Inversion of the Binomial and Negative Binomial Cumulative Distribution Functions.” ETNA - Electronic Transactions on Numerical Analysis 52 (2020): 270–80, Section 3, Pg 6.
[2] Cornish, E. A., and R. A. Fisher. “Moments and Cumulants in the Specification of Distributions.” Revue de l’Institut International de Statistique / Review of the International Statistical Institute 5, no. 4 (January 1938): 307.