pbinom gives the cumulative chance of AT MOST q successes, written P(X <= q) — q wins or fewer. (e.g. pbinom(2, 10, 0.5) = 0.055)
It adds up dbinom for every value from 0 through q. (e.g. P(0)+P(1)+P(2))
Use it for questions like q or fewer heads in n flips. (e.g. at most 2 of 10)
For more than q, take 1 minus the cumulative value. (e.g. 1 - pbinom(2,10,0.5))
At q = n the total is always 1, since every outcome is covered. (e.g. pbinom(10,10,0.5) = 1)
Definition
F(q)=k=0∑q(kn)pk(1−p)n−k
q
successes counted up to
n
number of trials (size)
p
chance of success each trial
P(X≤2)=210(010)+(110)+(210)=102456=0.0547
Where you'd use it
Flip a fair coin 10 times: the chance of 3 or fewer heads is pbinom(3, 10, 0.5) ≈ 17%, telling you a result that low is uncommon but not rare.
A box of 20 eggs each has a 5% chance of being cracked. The chance of no more than 2 cracked is pbinom(2, 20, 0.05) ≈ 92%, so most boxes pass an “at most 2” rule.
A guesser answers 10 true/false questions (p = 0.5). The chance of getting at least 8 right is the upper tail, pbinom(7, 10, 0.5, lower.tail = FALSE) ≈ 5%, so scoring 8+ by luck alone is unlikely.
Frequently asked questions
Does pbinom include k?
Yes — pbinom(k) = P(X ≤ k). For P(X < k) use pbinom(k − 1).
How do I get P(at least k)?
Use pbinom(k − 1, lower.tail = FALSE), which is P(X ≥ k).