Statistics Toolbox    
nbininv

Inverse of the negative binomial cumulative distribution function (cdf)

Syntax

Description

X = nbininv(Y,R,P) returns the inverse of the negative binomial cdf with parameters R and P at the corresponding probabilities in 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. Vector or matrix inputs for Y, R, and P must have the same size, which is also the size of X. A scalar input for Y, R, or P is expanded to a constant matrix with the same dimensions as the other inputs.

The simplest motivation for the negative binomial is the case of successive random trials, each having a constant probability P of success. The number of extra trials you must perform in order to observe a given number R of successes has a negative binomial distribution. However, consistent with a more general interpretation of the negative binomial, nbininv allows R to be any positive value, including nonintegers.

Example

How many times would you need to flip a fair coin to have a 99% probability of having observed 10 heads?

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
icdf, nbincdf, nbinfit, nbinpdf, nbinrnd, nbinstat


  nbinfit nbinpdf