Image of Blaise Pascal with probability mass function for the negative binomial distribution

Negative Binomial Probability Calculator






The binomial distribution gives the probability of having k successes in a fixed number of trials, given some fixed probability of success on each trial. The negative binomial distribution asks a different question: what is the probability that the rth success will occur on the kth trial, where k varies from r to infinity, given a fixed r, and some fixed probability of success on each trial?

Impetus for this calculator arose from a question about online dating. What, I was asked, is the chance of finding a suitable match on the third date, assuming the probability of finding a match on each date is .05? This is the geometric distribution, a special case of the negative binomial where r=1, and this calculator can give the answer (about a 4.5% chance of finding a suitable match on the third date, and a 14.3% chance of finding it on or before the third date). Unfortunately, expectation is that about 5% of people will not have found a match after 58 dates, and about one percent will not have found a match after 90 dates. Blame not thyself, blame Fortuna.

For a more interesting example, consider a realtor (or "realatur" as they say in Minnesota) who estimates a 30% chance of getting an offer each time a particular house is shown. What are his chances of having three offers on or before the tenth showing? Click here to find out.

This reminds me of a famous story about Thomas Edison. One day, Edison collared an apprentice and said, "We're going out." He took the apprentice to a street corner near the laboratory. For an hour, Edison propositioned every woman who passed. All rejected him. Then he and the apprentice returned to the lab. "Mr. Edison," the apprentice said, "I don't understand this. You propositioned one hundred women, got stuck with a hat pin 23 times, kicked in the shins 72 times, slapped 43 times, and there was that one woman who did all those things besides stamping on your toes and stabbing you in the groin with her parasol. What did you gain from this?" And Edison said, "Young man, you don't understand. It's true I have found one hundred women who rejected my lascivious advances, but that just puts me one hundred closer to finding the one who won't."

Caveat arithemeticus: Numbers displayed show 10 significant digits and scale from about 10-322 to 10322. Cumulative probability approaches 1; if the significand rounds to 1, it just shows 1. Display ends when (1) cumulative probability toPrecision(10) = 1.000000000; or (2) k = 10,000; or (3) one or more factors goes out of range. If a factor goes out of range, a message is displayed showing the factor and its JavaScript value. When that occurs, note that a JavaScript value of zero or "infinity" does not really mean zero or infinity, just a positive number smaller or larger than the range of JavaScript's floating point representation.

When the calculator is run, the URL in the address bar is updated with a querystring. This is done as a convenience for the user, who may wish to save or forward a URL that will duplicate the results shown, but also to ensure that the URL matches page content. Clicking the Clear button will clear the querystring to give the bare URL.

Charting is done with the Highcharts JavaScript library, which we highly recommend (click the hamburger icon on a chart for print, image or pdf download options).



Note on Edison. I'm a little surprised that nobody has emailed me about the Edison story saying "Edison was a fool! The geometric distribution is memoryless, and Edison's failure on the first 100 trials did not put him any closer to fulfilling his lustful desires!" But perhaps the inventor's strategy was to drive upright women from the precincts of his laboratory and attract those of dubious character, who might provide the lubricious ministrations he sought. In that scenario, each trial would indeed put him closer to his goal.