The binomial distribution

Analytika TeamLast reviewed 5 min read

How likely is it to get 3 heads in 5 coin flips? Or for 12 of 20 patients to respond to a treatment that works 50% of the time? Questions about counts of yes/no outcomes are answered by the binomial distribution.

When it applies

  1. A fixed number of trials, n.
  2. Each trial has two outcomes: success or failure.
  3. Trials are independent.
  4. The probability of success, p, is the same on every trial.

The formula

P(X = k) = C(n, k) × pᵏ × (1 − p)ⁿ⁻ᵏ

C(n, k) is the number of ways to choose which k of the n trials are successes.

Worked example: 5 fair coin flips

Heads (k)012345
Probability.031.156.313.313.156.031

For example, P(3 heads) = C(5, 3) × 0.5³ × 0.5² = 10 / 32 = .3125. The mean is np = 2.5 and the variance np(1 − p) = 1.25.

Shape

With p = 0.5 the distribution is symmetric. With p far from 0.5 it’s skewed. With large n it becomes approximately normal, which is the basis of the classic z-test for a proportion. The approximation is reasonable when np and n(1 − p) are both at least about 10.

Where it’s used

  • The binomial test: is an observed proportion different from an expected one? In R’s mtcars data, 13 of 32 cars are manual. If manuals and automatics were equally common, a split this uneven would occur with probability p = .377, so there’s no evidence against a 50:50 split.
  • Logistic regression, which models how p changes with predictors.
  • Confidence intervals for proportions, such as the Clopper-Pearson exact interval.

For counts of events with no fixed number of trials, see the Poisson distribution.

More in Probability distributions

Run this on your own data

Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.

Try it free