?How to use Negative Binomial Expected Value Calculator▶
Set r (required successes) and p (success probability) with the sliders or the number boxes; the box reports E(X)=r(1−p)/p, the success rate and the expected total trials. Learn more about the parameters
The panel on the right shows E(X), the expected failures, with its formula, examples in context, and Additional Statistics (variance, standard deviation, mode) behind a toggle. Learn more about the panel
Click Compare with Different Values to set an alternative r and p and see the two expected values side by side. Learn more about comparing
Use the tabs E(X) Visualization, How E(X) is Calculated and Individual Contributions for a chart, the steps, or each count's share. Learn more about the tabs
The box under the calculator explains what E(X) means and why it equals r(1−p)/p. Learn more about the box
Expected Value Calculator - Negative Binomial Distribution
Calculate the expected value (average number of failures before r successes) for a negative binomial distribution. Perfect for quality control, sales quotas, or any scenario where you need a certain number of successes.
💡
Key Insight: E(X) = 7.00 means on average you will experience 7.00 failures before getting your 3 required successes. Total trials needed: about 10.00.
Parameters
Formula:E(X) = r(1-p) / p
Success rate:30.0%
Expected total trials:10.00
Expected Value (Failures Before 3 Successes)
E(X) = 7.0000
Formula: r(1-p)/p = 3×0.70/0.3 = 7.00
Interpretation: On average, expect 7.00 failures before getting 3 successes
📊E(X) in Context: Moderate success rate
30% success rate, need 3 successes? Expect 7.0 failures
Total expected trials: 10.0
Typical range: 3 to 12 failures
Probability Distribution with E(X) = 7.00
Probability
E(X) = 7.00
0.027
0
0.057
1
0.079
2
0.093
3
0.097
4
0.095
5
0.089
6
0.080
7
0.070
8
0.060
9
0.050
10
0.042
11
0.034
12
0.027
13
0.022
14
0.017
15
0.014
16
0.011
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Number of Failures
Understanding Expected Value for Negative Binomial Distribution
What Does E(X) Mean? The expected value E(X) represents the average number of failures you will experience before achieving r successes. It is the cost in terms of failed attempts to reach your success goal.
Interpreting Your Result. Expect E(X) failures before the r successes; the total trials needed are about E(X) + r; each trial is independent with the same success rate p.
Real-World Examples.Sales (r = 5, p = 0.2): need 5 sales? Expect 20 rejections. Quality control (r = 3, p = 0.05): find 3 defects? Expect 57 good items. Job interviews (r = 2, p = 0.3): need 2 offers? Expect 4.7 rejections.
Why E(X) = r(1 - p) / p. This is a generalization of the geometric distribution. For one success (r = 1), you expect (1 - p)/p failures. For r successes, you need r times as many failures on average. This assumes each trial is independent with constant probability p. Learn more about the negative binomial distribution
Use the calculator below to compute the expected value with step-by-step solutions and detailed explanations.
Setting r and p
DemoFour free throws, r = 1, a rare success, Reset
Step 0 of 4
Under Parameters, set r (Required Successes) and p (Success Probability) with the sliders or by typing in the boxes; the slider for r runs from 1 to 20 and the one for p from 0.01 to 1, while the boxes take any whole number r≥1 and any p above 0 and up to 1 (a typed p is kept between 0.0001 and 1, and a non-positive r is ignored). The calculator counts the failures before the r-th success, so the box reports the formula E(X)=r(1−p)/p, the Success rate as a percentage and the Expected total trials, which is E(X)+r; the Key Insight line above the calculator says the same in words.
For r=4 and p=0.8, the free-throw example of the formula section, E(X)=1.0000 failure and the expected total is 5.00 attempts. With r=1 the context switches to the geometric case, E(X)=0.2500. A Contribution to E(X) table lists each failure count k with P(X=k) and the product k⋅P(X=k) while at most 20 counts are needed to cover 99.9% of the probability; the chart stays up to 50 counts, and beyond that a note says the individual probabilities are not all shown, as for r=1 and p=0.05, where E(X)=19.0000. If r is left blank, the right panel shows "Enter valid parameters: r > 0 and 0 < p ≤ 1". There is no Calculate button.
Reset, at the top right of the parameter box, returns to r=3 and p=0.3, with E(X)=7.0000 failures and 10.00 expected trials, closes the comparison and the extra statistics, and selects the first tab. What the two numbers mean is explained in the negative binomial distribution.
Reading the Expected Value Panel
DemoFive sales at 20%, the extra statistics, p = 0.5
Step 0 of 3
The right panel is built around one number: E(X), the expected failures before r successes, in large type, with the formula r(1−p)/p filled in and an interpretation line. Below it, E(X) in Context turns the number into a scenario chosen from the parameters: r=1 reads "Geometric case", p≤0.2 "Low success rate (difficult task)", p≥0.7 "High success rate (easy task)", and anything else "Moderate success rate"; each gives three lines, among them the expected total trials and a typical range. Click ▶ Additional Statistics to open the variance r(1−p)/p2, the standard deviation and the Mode, the most likely number of failures, ⌊(r−1)(1−p)/p⌋ for r>1 and 0 for r=1.
For r=5 and p=0.2 the panel reads E(X)=20.0000 with the low-success scenario, 25.0 expected trials and a typical range of 15 to 35 total trials; the variance is 100.0000, the standard deviation 10.0000 and the mode 16 failures. With p=0.5 and the same r it reads 5.0000, 10.0000, 3.1623 and a mode of 4 failures. The box under the calculator, Understanding Expected Value for Negative Binomial Distribution, explains what E(X) means, gives three stock examples and shows why the formula is r(1−p)/p; its link opens the first section below. The trials version of the same formula is worked through in formula and worked example.
Comparing Two Settings
Demor = 3, p = 0.3 against 5 at 0.5, 5 at 0.2, itself
Step 0 of 3
Click ▶ Compare with Different Values under the parameter box to open an Alternative r and Alternative p. The panel then shows the current setting with its expected failures, the alternative with its expected failures, and the difference as a percentage of the current value, marked with an arrow as more or fewer failures expected. The alternative opens as r=5, p=0.5: against r=3, p=0.3 that is E(X)=5.00 failures, 28.6% fewer than 7.00. Change the alternative p to 0.2 and its E(X) becomes 20.00, 185.7% more; set the alternative to r=3, p=0.3 and the panel says the two have the same expected value.
The comparison shows how the two numbers pull in opposite directions: more required successes add failures in proportion to r, while a higher success rate removes them faster than in proportion, because p appears in the denominator. An alternative with p at 0 or above 1 shows nothing. Why E(X) is r times the geometric wait is explained in the negative binomial distribution.
Under the statistics are three tabs; they change what is drawn, not the numbers. E(X) Visualization (the default) draws one bar per failure count k with height P(X=k) and marks the expected value; for r=3 and p=0.3 the bars rise to a peak at 4 failures and tail off to the right of the mark at 7. When more than 50 counts are needed the chart gives way to a summary with the parameters and the typical range. How E(X) is Calculated writes the formula and four steps: identify r and p, compute the failure rate 1−p, apply r(1−p)/p, and compute; for r=3 and p=0.7 the steps end in 1.2857 failures, followed by a sentence on adding up r geometric waits. Individual Contributions, shown only while at most 20 counts are listed, draws each product k⋅P(X=k) as a bar.
Use the calculation tab to check a homework answer, the visualization to see the skewed shape, and the contributions to see which failure counts carry the mean. Reset returns to the visualization tab. The steps of the calculation tab are the failure-count form of the formula in formula and worked example.
The Negative Binomial Distribution
The negative binomial distribution counts the number of independent trials needed to get r successes, where each trial succeeds with probability p. It generalizes the geometric distribution, which is the case r=1.
The expected value follows from splitting the wait into r stages. Waiting for each success takes p1 trials on average, and the r waits add up. In this version X counts all trials, including the r successes.
Example: a basketball player makes each free throw with probability p=0.8. The expected number of attempts to make 4 free throws is
E[X]=0.84=5
Some books count only the failures before the r-th success. That version has expected value pr(1−p), which is 1 here: on average 5 attempts, of which 1 is a miss. The calculator above uses this failure-count version and adds r to report the expected total trials.
The negative binomial distribution is used when a fixed number of successes is the goal: the number of calls needed to make 10 sales, the number of inspections needed to find 3 defective parts, or the number of trials needed to recruit r patients for a study.
The failure-count version is also used for count data that varies more than a Poisson model allows, such as the number of accidents per driver or the number of insurance claims per customer.