Search code examples
algorithmmathprobabilitybinomial-cdf

How can I efficiently calculate the negative binomial cumulative distribution function?


This post is really helpful:

How can I efficiently calculate the binomial cumulative distribution function?

(Title = How can I efficiently calculate the binomial cumulative distribution function?)

However, I need the negative binomial cumulative distribution function.

Is there a way to tweek the code to get a negative cumulative distribution function?


Solution

  • You can compute the CDF by summing the terms of the PMF taking advantage of the recurrence relationship the terms satisfy. The terms in the series are a little complicated, but the ratio of consecutive terms is simple.