Binomial cumulative probabilities and pbinom
◈ 5 cardsAdd the pmf up to k; "at least" by the complement; and what dbinom and pbinom return — the "more than" trap.
Building the cumulative table
For the pmf values, from L6.4's formula:
| 0 | 1 | 2 | 3 | 4 | |
|---|---|---|---|---|---|
| 0.1422 | 0.3012 | 0.2924 | 0.1720 | 0.0683 | |
| 0.1422 | 0.4435 | 0.7358 | 0.9078 | 0.9761 |
The second row is the running total — the cumulative probability. Any phrase from L6.1 is now one or two lookups:
- At most 2 errors: .
- At least 3: . Ten terms by the direct route; one subtraction by the complement.
- More than 3: .
- Between 1 and 3 inclusive: .
Every cumulative question reduces to which goes into and whether to subtract from 1. That is the whole skill.
What R prints
The paper may hand you R output instead of a table. Two functions matter:
> dbinom(2, 12, 0.15)
[1] 0.2923585
> pbinom(2, 12, 0.15)
[1] 0.7358181
> 1 - pbinom(2, 12, 0.15)
[1] 0.2641819
dbinom(x, n, p) is the pmf, — the d is for density, the name R uses for both kinds of variable. pbinom(k, n, p) is the cumulative — less than or equal, always. So 1 - pbinom(2, …) is , and the three printed lines are the three hand values above at seven significant figures.
The trap
"More than 2" is not 1 - pbinom(2, …). That expression is — which is more than 2. The trap runs the other way: "at least 2" is = 1 - pbinom(1, …), not 1 - pbinom(2, …). Translate the phrase to an inequality, move the boundary so the right side is , then write the call:
| Phrase | Inequality | R |
|---|---|---|
| at most | pbinom(k, n, p) | |
| fewer than | pbinom(k - 1, n, p) | |
| more than | 1 - pbinom(k, n, p) | |
| at least | 1 - pbinom(k - 1, n, p) |
R also accepts lower.tail = FALSE, which returns directly — the same as 1 - pbinom(k, …); you will meet it in Module 7 with pnorm.
Reading the seven digits
R prints 0.7358181 where the hand table says 0.7358. Both are right; the paper's tolerance (±0.0005 for a four-decimal pmf sum) accepts either. Never quote more decimals than the question's own inputs support.