| Statistics Toolbox | Search  Help Desk |
| nbininv | Examples See Also |
Inverse of the negative binomial cumulative distribution function (cdf).
Syntax
X = nbininv(Y,R,P)
Description
nbininv(Y,R,P) returns the inverse of the negative binomial cdf with parameters R and P. Since the binomial distribution is discrete, nbininv returns the least integer X such that the negative binomial cdf evaluated at X, equals or exceeds Y.
The size of X is the common size of the input arguments. A scalar input functions as a constant matrix of the same size as the other inputs.
The negative binomial models consecutive trials each having a constant probability, P, of success. The parameter, R, is the number of successes required before stopping.
Example
How many times would you need to flip a fair coin to have a 99% probability of having observed 10 heads?flips = nbininv(0.99,10,0.5) + 10
flips =
33
Note that you have to flip at least 10 times to get 10 heads. That is why the second term on the right side of the equals sign is a 10.
See Also
nbincdf,nbinpdf,nbinrnd,nbinstat