### Negative Binomial Probability Calculator

Cumulative probability toPrecision(10) = 1.000000000 reached at k=85

Negative Binomial results for p = 0.3 and r = 3
Mean = 10
Median = 9 (~8.58)
Mode = 7
Variance = 23.33333333;
Std. Dev. = 4.830458915

Negative Binomial results for p = 0.3 and r = 3
Mean = 10
Median = 9 (~8.58)
Mode = 7
Variance = 23.33333333;
Std. Dev. = 4.830458915
k
Number of trials
Probability of third success on kth trial Probability of third success on kth trial or less Binomial coefficient
k-1C2
30.027000000000.027000000001
40.056700000000.083700000003
50.079380000000.16308000006
60.092610000000.255690000010
70.097240500000.352930500015
80.095295690000.448226190021
90.088942644000.537168834028
100.080048379600.617217213636
110.070042332150.687259545745
120.059925106390.747184652155
130.050337089370.797521741566
140.041642501210.839164242778
150.034008042650.873172285491
160.027468034450.9006403198105
170.021974427560.9226147474120
180.017433045860.9400477933136
190.013728523620.9537763169153
200.010740550830.9645168677171
210.0083537617570.9728706295190
220.0064631735700.9793338030210
230.0049766436490.9843104467231
240.0038154267980.9881258735253
250.0029135986450.9910394721276
260.0022168685350.9932563407300
270.0016811253050.9949374660325
280.0012709307310.9962083967351
290.00095808624330.9971664829378
300.00072033891620.9978868219406
310.00054025418720.9984270760435
320.00040425916760.9988313352465
330.00030184684520.9991331821496
340.00022492458460.9993581066528
350.00016728765980.9995253943561
360.00012419841410.9996495927595
370.000092052942220.9997416457630
380.000068119177240.9998097648666
390.000050332503190.9998600973703
400.000037137225320.9998972346741
410.000027364271290.9999245988780
420.000020137297080.9999447361820
430.000014800913350.9999595370861
440.000010866036390.9999704031903
450.0000079684266850.9999783715946
460.0000058373358270.9999842088990
470.0000042718684920.99998848071,035
480.0000031232105190.99999160391,081
490.0000022813015970.99999388521,128
500.0000016648647820.99999555011,176
510.0000012139639040.99999676401,225
528.844594156e-70.99999764851,275
536.438864546e-70.99999829241,326
544.683958326e-70.99999876081,378
553.404877399e-70.99999910131,431
562.473354337e-70.99999934861,485
571.795472037e-70.99999952821,540
581.302533351e-70.99999965841,596
599.443366792e-80.99999975281,653
606.842299096e-80.99999982131,711
614.954768311e-80.99999987081,770
623.585908591e-80.99999990671,830
632.593807214e-80.99999993261,891
641.875195052e-80.99999995141,953
651.354979650e-80.99999996492,016
669.785964141e-90.99999997472,080
677.064242864e-90.99999998182,145
685.097122928e-90.99999998692,211
693.676106839e-90.99999999052,278
702.650088960e-90.99999999322,346
711.909622927e-90.99999999512,415
721.375482021e-90.99999999652,485
739.903470554e-100.99999999752,556
747.127709089e-100.99999999822,628
755.127990706e-100.99999999872,701
763.687938521e-100.99999999912,775
772.651328775e-100.99999999932,850
781.905421613e-100.99999999952,926
791.368895001e-100.99999999973,003
809.831155005e-110.99999999983,081
817.058265132e-110.99999999983,160
825.065868772e-110.99999999993,240
833.634760844e-110.99999999993,321
842.607155618e-110.99999999993,403
851.869521345e-111.0000000003,486
Display ends because: Cumulative probability toPrecision(10) = 1.000000000 reached at k=85

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.