Formula: Negative Binomial & Geometric Formula
- requiredSuccessesR: Required Successes R (r successes)
- singleTrialSuccessProbP: Single Trial Success Prob P (p)
- totalTrialsEvaluatedN: Total Trials Evaluated N (n trials)
Calculate expected trials and probability of achieving the r-th success on trial n.
The PMF gives the chance of finishing on one exact trial, and the probability is spread across many possible trials. Even the most likely trials, 8 and 9, carry only about 7.79% each. A single exact value is rarely likely in a spread-out distribution. For a broader question, add up the PMF across a range of trials.
Counting trials includes the r successes, so it always starts at r. Counting failures excludes them and starts at zero. The two differ by exactly r, so the mean shifts by r while the variance stays the same. The default shows 12 expected trials and 9 expected failures for that reason.
In this waiting-time model r counts successes, so it must be a whole number of 1 or more. Entering a decimal such as 1.8 brings up an input message instead of a result. If you need a non-integer r for a modelling reason, such as an overdispersed count model, this calculator is not the right tool.
That is a different use of the same family. In regression, the negative binomial models counts whose variance exceeds the mean, and its shape parameter can be any positive number. This calculator handles the waiting-time version only, with a whole-number r and a known p, so use statistical software for fitting count models.
Yes. If you have already failed several times, the expected number of further trials until success is still 1 over p, the same as at the start. Past failures do not bring a success closer. That property applies to the geometric case, r equal to 1. The negative binomial with larger r is not memoryless in the same way.
For r greater than 1, the mode is the whole-number part of 1 plus (r minus 1) divided by p. With r at 3 and p at 0.25 that expression is exactly 9, and in that case trials 8 and 9 tie. You can confirm it by entering trials on either side and comparing the PMF values.
The page asks you to check the inputs, because p must be strictly between 0 and 1. At 0 no success ever arrives, and at 1 every trial succeeds, so the r-th success always comes on trial r. Neither is a useful distribution. Values close to the ends are allowed, but small p gives very long expected waits.
They describe the same trials from opposite directions. The binomial fixes the number of trials and asks how many successes occur. The negative binomial fixes the number of successes and asks how many trials are needed. Finishing by trial n is the same event as getting at least r successes in n trials, which links their cumulative probabilities.
The variance is r times (1 minus p) divided by p squared, so halving p roughly quadruples it. With r at 1 and p at 0.1 the standard deviation is about 9.49 against a mean of 10. Rare successes make waiting times very unpredictable, and planning around the mean alone leaves a high chance of overrunning.
Yes, but treat the results as estimates. If your p comes from a small sample, the true value could be quite different, and because the mean is r divided by p, errors in p have a large effect when p is small. Try a lower and a higher plausible p to see how sensitive the answer is.
The formula assumes a single p for every trial. If success chances differ, for example improving with practice or varying between batches, the counts no longer follow a negative binomial. You can still use an average p for a rough idea, but the spread of real outcomes may be wider than the page suggests.
The default asks a simple waiting question. Each trial succeeds with probability 0.25, independently of every other trial, and you keep going until you have 3 successes. How many trials will that take?
The calculator's main answer is the expected number: 12 trials. Of those, 3 are the successes and 9 are failures, which is the expected failures line. The standard deviation is 6 trials, so the spread around that average is wide. Finishing in 6 trials or needing 18 would both be quite normal.
The other supporting figure answers a narrower question: what is the chance that the third success arrives on exactly trial 10? The answer is about 7.51%. That is the probability mass function, or PMF, at n = 10. It is not the chance of being finished by trial 10, which is a much larger number and is covered further down.
For the third success to land on trial 10, two things must both be true. Trial 10 must be a success, and exactly 2 of the first 9 trials must be successes. The order of those first 9 does not matter, so we count the arrangements.
There are C(9, 2) ways to choose which 2 of the first 9 trials succeed, and C(9, 2) is 36. Each such sequence has 3 successes and 7 failures in total, so its probability is 0.25 cubed times 0.75 to the seventh. 0.25 cubed is 0.015625 and 0.75 to the seventh is about 0.1335. Multiplying 36 by both gives about 0.0751, or 7.51%.
That is the formula on the page in plain steps: C(n minus 1, r minus 1) times p to the r times (1 minus p) to the (n minus r). The n minus 1 and r minus 1 appear because the last trial is fixed as a success, so only the earlier trials can be rearranged.
The results line shows 7.509% while the summary sentence says 7.508%. The exact value is 0.07508 and a bit, so 7.508% is the correctly rounded figure. The difference is a display rounding detail and does not affect anything else on the page.
The expected number of trials is r divided by p. With 3 successes at a quarter each, that is 3 divided by 0.25, or 12. The intuition is that each success takes 1 over p trials on average, four in this case, and you need three of them in a row.
Expected failures are r times (1 minus p) divided by p, which is 3 times 0.75 divided by 0.25, or 9. The variance of the number of trials is r times (1 minus p) divided by p squared, which is 2.25 divided by 0.0625, or 36. Its square root is the 6 on the page.
Notice that the variance is the same whether you count trials or failures. The two counts differ by exactly r, a fixed number, so they share the same spread. Some textbooks define the negative binomial as the number of failures before the r-th success and others as the total number of trials. The calculator reports both means, so you can match whichever convention your course or software uses.
Doubling the success probability to 0.5 cuts the expected trials to 6, the expected failures to 3, and the standard deviation to about 2.45. Waiting gets shorter and much more predictable together.
The third preset raises r to 5 and evaluates n = 20, which is again the mean, r over p. Expected failures rise to 15 and the standard deviation to about 7.75, and the chance of finishing on exactly trial 20 is about 5.06%. More required successes spread the distribution wider, so each single trial holds less probability.
The distribution is skewed to the right. Most of the probability sits on fairly short waits, with a long tail of unlucky runs. That skew separates the three usual summaries.
The most likely single trial for the third success is a tie between trials 8 and 9, each with a probability of about 7.79%. You can check this by entering 8 and then 9 in the trials field. Trial 10 is a little lower at 7.51%, and trial 12, the mean, is lower still at 6.45%.
The median is trial 11: summing the PMF from trial 3 upward, the chance of being done by trial 10 is about 47.4% and by trial 11 about 54.5%. The mean of 12 sits above both, pulled up by the long tail. There is roughly a 9% chance of needing more than 20 trials.
This matters if you are planning around the result. Budgeting for the expected 12 trials means you will run short a little under 40% of the time, since the chance of finishing by trial 12 is about 60.9%. For a plan that rarely fails you need to look further into the tail.
When you need only one success, the negative binomial becomes the geometric distribution, the number of trials until the first success. Set r to 1 with the default p of 0.25 and the expected trials drop to 4, with 3 expected failures and a standard deviation of about 3.46.
The PMF simplifies to p times (1 minus p) to the (n minus 1), because the first n minus 1 trials must all fail. The chance the first success comes on trial 1 is just p, 25%. The chance it comes on trial 10 is about 1.88%. The geometric PMF is always largest at trial 1 and falls steadily after that, so the single most likely outcome is always immediate success, however small p is.
The geometric preset on the page uses r = 1 with n = 4, the expected trial. The chance that the first success comes on exactly trial 4 is about 10.55%, which is 0.25 times 0.75 cubed. Even at the mean, a single exact trial carries only a modest share of the probability.
With p at 0.1 and r at 1, the expected wait is 10 trials and the standard deviation is about 9.49, almost as large as the mean. For rare events the geometric wait is extremely variable, which surprises people who expect the average to be a typical outcome.
Three assumptions sit under every number on the page. Each trial has only two outcomes. The success probability stays the same from trial to trial. And trials are independent, so a run of failures does not make the next success more or less likely.
Sales calls, quality inspections, free-throw attempts and repeated lab assays are common examples. Each fits only as far as those assumptions hold. If a salesperson improves with practice, p is rising. If items come from batches with different defect rates, trials are not independent. In both cases the calculator gives a rough first estimate rather than an accurate one.
Sampling without replacement is the other common mismatch. Drawing cards from a deck until you have three aces changes the odds after every draw, so the right model there is the negative hypergeometric, not this one. When the pool is very large compared with the number you draw, the difference becomes small and the negative binomial is a fair approximation.
The required successes field takes whole numbers from 1 upward, because you cannot need two and a half successes. A decimal such as 1.8 brings up a message asking you to check the inputs rather than a silently rounded answer. When r is 1 the heading reads Expected Total Trials for 1 Success, the geometric case.
The success probability must be strictly between 0 and 1. A probability of 0 would mean waiting forever and 1 would mean every trial succeeds, so neither gives a useful distribution, and the page rejects both. Very small values are allowed and produce very long waits: the mean r over p grows without limit as p shrinks, so check that a tiny p is really what you meant.
The trials field must be a whole number no smaller than r, because you cannot collect 3 successes in 2 trials. Asking for trial 2 with r at 3 returns an input message. The smallest valid n is r itself, and its probability is simply p to the power r: with the defaults, 0.25 cubed, about 1.56%.
Most practical questions are cumulative. What is the chance I am done within 10 attempts? The calculator gives one PMF value per run, so you can get a cumulative figure by summing the PMF for every trial from r up to your limit, running it once per trial.
There is a quicker route. The r-th success arrives by trial n exactly when there are at least r successes in the first n trials. So P(N at most n) equals the binomial probability of r or more successes in n trials, which most statistics tools give directly. For the default, the chance of at least 3 successes in 10 trials is about 47.4%, the same figure as summing the PMF from trial 3 to trial 10.
The complement gives the risk of a long wait. One minus that figure, about 52.6%, is the chance you will still need more trials after the 10th. That is often the number a planner needs most. If you are setting a budget of attempts, try a few limits and stop at the first one where the chance of finishing is high enough for your purpose. For the default, that point comes well beyond the mean of 12, because the right-hand tail is long and thin but it never quite reaches zero.