MATLAB/EXCEL Inverse Cumulative Distribution Function (ICDF) for Negative Binomial Distribution

461 Views Asked by At

I have some old MATLAB code that uses the ICDF() function call (inverse cumulative distribution function). I need to translate the following into an equivalent formula (or formulas) in Excel. Here are specifics of the old MATLAB code that works (circa R2012b). Unfortunately, I cannot currently run this MATLAB code and get a result.

X = RAND()

N = 745

A = 1

B = 1/(1+N)

Result = icdf( 'nbin', X, A, B )

The old MATLAB Docs state this: Y = icdf(name,X,A,B) computes the inverse cumulative distribution function for two-parameter families of distributions, where parameter values are given in A and B.

A is $r$: number of successes

B is $p$: probability of success in a single trial


I have obtained a function in Excel that will compute the Inverse Negative Binomial with the following arguments.

NEGBINOM_INV(alpha, k, p) = smallest integer $x$ such that NEGBINOM.DIST(x, k, p, TRUE) ≥ alpha. NEGBINOM.DIST is an Excel Function.

Key statistical properties of the negative binomial distribution are:

Mean = $k(1 – p) ⁄ p$

Variance = $k(1 – p) ⁄ p^2$


My specific question is what values are needed for the arguments of the NEGBINOM_INV(alpha, k, p) to duplicate the MATLAB ICDF function.

I have tried the following but am suspect of my argument values.

NEGBINOM_INV( RAND(), 1, 1/(1+745) )

TIA.