Unit 4, lesson 23

Bernoulli, Binomial and Hypergeometric Models

How a Bernoulli trial leads to the binomial distribution, which conditions a binomial setting needs, the binomial mean and variance, and when the hypergeometric distribution fits sampling a finite batch without replacement.

  • Video 23
  • Discrete Random Variables and Models

An inspector examines four items and counts how many carry a flag. In one setting a process flags each item independently with probability 0.20.2. In the other, the four items are drawn without replacement from a batch of ten that contains exactly two flagged items. Both start from the same 20 percent, yet the chance of exactly two flagged items is 0.15360.1536 in the first setting and 215≈0.1333\tfrac{2}{15} \approx 0.1333 in the second. This lesson builds the Bernoulli and binomial models for independent trials and the hypergeometric model for sampling a fixed batch, and it shows which conditions decide between them.

Key terms

Bernoulli distribution

Definition A Bernoulli trial is a single random experiment whose outcome falls in exactly one of two categories, called success and failure. Its indicator XX takes the value 11 for a success and 00 for a failure. If P(X=1)=pP(X = 1) = p for a number pp with 0≤p≤10 \le p \le 1, then XX has the Bernoulli distribution with success probability pp, written X∼Bernoulli⁡(p)X \sim \operatorname{Bernoulli}(p), and

P(X=1)=p,P(X=0)=1−p.\begin{gathered} P(X = 1) = p, \\[0.4em] P(X = 0) = 1 - p. \end{gathered}

A variable that takes only the values 00 and 11 satisfies X2=XX^2 = X, so its second moment is E(X2)=pE(X^2) = p. Subtracting the squared mean p2p^2 gives

E(X)=p,Var⁡(X)=p(1−p).\begin{gathered} E(X) = p, \\[0.4em] \operatorname{Var}(X) = p(1 - p). \end{gathered}

In plain words Success is simply the outcome being counted, and it can be an unwelcome one such as a defective part or a missed deadline. The mean of a variable that takes only the values 00 and 11 is the probability of a 11. The variance is 00 when pp is 00 or 11, because the outcome is then certain, and it is largest, equal to 14\tfrac14, when p=12p = \tfrac12.

Example Inspect one item and record X=1X = 1 if it is flagged, where an item is flagged with probability p=0.2p = 0.2. Then E(X)=0.2E(X) = 0.2, Var⁡(X)=0.2⋅0.8=0.16\operatorname{Var}(X) = 0.2 \cdot 0.8 = 0.16 and SD⁡(X)=0.4\operatorname{SD}(X) = 0.4. The mean 0.20.2 is not a value that XX can take. It is the long-run average of XX over many independent repetitions, which is the long-run proportion of flagged items.

Binomial setting

Definition A binomial setting is a sequence of nn Bernoulli trials, where nn is a positive integer fixed in advance, such that the trials are independent and every trial has the same success probability pp. The binomial count is the number of successes,

X=X1+X2+⋯+Xn,X = X_1 + X_2 + \dots + X_n,

where XiX_i is the indicator of a success on trial ii.

In plain words The conditions describe how the data were produced, so they come from knowing the mechanism, not from the look of the data. A column of yes and no answers does not show that the answers are independent or that they share one success probability. Repeated outcomes from the same person are often related, and a process whose conditions drift does not keep a fixed pp. The number of trials also has to be set beforehand. Counting coin tosses until the first head, for example, does not give a binomial count, because the number of tosses is itself random.

Example Four items come off a process that flags each one independently with probability 0.20.2. This is a binomial setting with n=4n = 4 and p=0.2p = 0.2. Now draw four items one at a time without replacement from a batch of ten that contains exactly two flagged items. Each draw on its own is flagged with probability 0.20.2, but the draws are dependent. The second draw is flagged with probability 19\tfrac19 if the first was flagged and 29\tfrac29 if it was not, so the independence condition fails and this is not a binomial setting.

Binomial distribution

Definition In a binomial setting with nn trials and success probability pp, the count XX of successes has the binomial distribution, written X∼Binomial⁡(n,p)X \sim \operatorname{Binomial}(n, p), with

P(X=k)=(nk)pk(1−p)n−k\begin{aligned} &P(X = k) \\[0.4em] &\quad = \binom{n}{k} p^k (1 - p)^{n - k} \end{aligned}

for k=0,1,…,nk = 0, 1, \dots, n. By independence, any particular sequence of trials with kk successes and n−kn - k failures has probability pk(1−p)n−kp^k (1 - p)^{n - k}. There are (nk)\binom{n}{k} such sequences, one for each choice of the positions of the successes, and they are disjoint events, so their probabilities add. When 0<p<10 < p < 1 every integer from 00 to nn has positive probability. When p=0p = 0 the count is 00 with probability 11, when p=1p = 1 it is nn with probability 11, and the formula still holds in both cases with the convention 00=10^0 = 1.

In plain words The binomial coefficient counts the ways to place the successes among the trials, and the powers give the probability of each placement. Every placement with the same number of successes has the same probability, which is why one product covers them all.

Example For X∼Binomial⁡(4,0.2)X \sim \operatorname{Binomial}(4, 0.2), one sequence with two successes, such as success, success, failure, failure, has probability 0.22⋅0.82=0.02560.2^2 \cdot 0.8^2 = 0.0256, and there are (42)=6\binom{4}{2} = 6 such sequences, so

P(X=2)=6⋅0.04⋅0.64=0.1536.\begin{aligned} P(X = 2) &= 6 \cdot 0.04 \cdot 0.64 \\[0.4em] &= 0.1536. \end{aligned}

The whole distribution is below, and its masses add to 11.

kk0011223344
P(X=k)P(X = k)0.40960.40960.40960.40960.15360.15360.02560.02560.00160.0016

Binomial mean and variance

Definition If X∼Binomial⁡(n,p)X \sim \operatorname{Binomial}(n, p), then

E(X)=np,Var⁡(X)=np(1−p),SD⁡(X)=np(1−p).\begin{gathered} E(X) = np, \\[0.4em] \operatorname{Var}(X) = np(1 - p), \\[0.4em] \operatorname{SD}(X) = \sqrt{np(1 - p)}. \end{gathered}

Write the count as X=X1+⋯+XnX = X_1 + \dots + X_n with each Xi∼Bernoulli⁡(p)X_i \sim \operatorname{Bernoulli}(p). Linearity of expectation gives the mean as a sum of nn copies of pp, and this step needs no independence. The variance of a sum of independent variables is the sum of their variances, which gives nn copies of p(1−p)p(1 - p).

In plain words On average the count equals the number of trials times the success probability. The mean need not be a possible count, and a mean below 11 does not keep the count below 11. For a fixed nn the variance is largest when p=12p = \tfrac12, and it is 00 when pp is 00 or 11.

Example For Binomial⁡(4,0.2)\operatorname{Binomial}(4, 0.2) the mean is 4⋅0.2=0.84 \cdot 0.2 = 0.8 and the variance is 4⋅0.2⋅0.8=0.644 \cdot 0.2 \cdot 0.8 = 0.64, so the SD is 0.80.8. The table above confirms both. The sum of k P(X=k)k \, P(X = k) over all kk is 0.80.8, the sum of k2P(X=k)k^2 P(X = k) is 1.281.28, and 1.28−0.82=0.641.28 - 0.8^2 = 0.64. Although the mean is below 11, two or more flagged items occur with probability 0.18080.1808.

Hypergeometric distribution

Definition A population of N≥1N \ge 1 items contains KK marked items, where 0≤K≤N0 \le K \le N. A sample of nn items, with 0≤n≤N0 \le n \le N, is drawn without replacement so that every subset of nn items has the same chance 1/(Nn)1 / \binom{N}{n}. The number HH of marked items in the sample has the hypergeometric distribution with parameters NN, KK and nn, and

P(H=k)=(Kk)(N−Kn−k)(Nn)P(H = k) = \frac{\binom{K}{k}\binom{N - K}{n - k}}{\binom{N}{n}}

for every integer kk with max⁡(0,n−(N−K))≤k≤min⁡(n,K)\max(0, n - (N - K)) \le k \le \min(n, K), while P(H=k)=0P(H = k) = 0 for every other kk. The numerator counts the samples made of kk of the marked items and n−kn - k of the unmarked ones. The mean is E(H)=nK/NE(H) = nK/N, and with p=K/Np = K/N and N≥2N \ge 2 the variance is

Var⁡(H)=np(1−p)×N−nN−1.\begin{aligned} \operatorname{Var}(H) &= np(1 - p) \\[0.4em] &\quad \times \frac{N - n}{N - 1}. \end{aligned}

In plain words Removing an item changes what is left, so the draws are dependent whenever the batch holds both marked and unmarked items, and only counts that the batch can actually supply are possible. The sample cannot hold more marked items than the batch has or than its own size allows, and a sample larger than the number of unmarked items must contain some marked ones. The factor (N−n)/(N−1)(N - n)/(N - 1) equals 11 when n=1n = 1, lies below 11 when n≥2n \ge 2, and equals 00 when n=Nn = N, since a sample of the whole batch gives H=KH = K for certain. This model treats the batch as fixed, and its only randomness is which items get drawn.

Example Draw four items from a batch of ten that contains two flagged items, so N=10N = 10, K=2K = 2 and n=4n = 4. The support runs from max⁡(0,4−8)=0\max(0, 4 - 8) = 0 to min⁡(4,2)=2\min(4, 2) = 2. Exactly two flagged items means both flagged items and two of the eight others, so

P(H=2)=(22)(82)(104)=28210=215.\begin{aligned} P(H = 2) &= \frac{\binom{2}{2}\binom{8}{2}}{\binom{10}{4}} \\[0.4em] &= \frac{28}{210} = \frac{2}{15}. \end{aligned}

The table compares this batch with the independent process of the earlier cards.

Flagged count0011223344
Binomial0.40960.40960.40960.40960.15360.15360.02560.02560.00160.0016
Hypergeometric13\tfrac13815\tfrac{8}{15}215\tfrac{2}{15}0000

Both models have mean 0.80.8, and the hypergeometric variance is 0.64⋅69=3275≈0.42670.64 \cdot \tfrac69 = \tfrac{32}{75} \approx 0.4267, smaller than the binomial 0.640.64. The batch view and the process view answer different questions. If the ten items were not a known batch but ten outputs of a process that flags each item independently with probability 0.20.2, and the four were sampled without looking at the flags, the count in the sample would again follow Binomial⁡(4,0.2)\operatorname{Binomial}(4, 0.2).

Check yourself

  1. A process flags each item independently with probability 0.10.1, and five items are inspected. Find the probability that exactly one is flagged, and the mean and variance of the number flagged.
Show the answer

The five inspections form a binomial setting, so the count is X∼Binomial⁡(5,0.1)X \sim \operatorname{Binomial}(5, 0.1) and

P(X=1)=5⋅0.1⋅0.94=0.32805.\begin{aligned} P(X = 1) &= 5 \cdot 0.1 \cdot 0.9^4 \\[0.4em] &= 0.32805. \end{aligned}

The mean is 5⋅0.1=0.55 \cdot 0.1 = 0.5 and the variance is 5⋅0.1⋅0.9=0.455 \cdot 0.1 \cdot 0.9 = 0.45.

  1. Decide whether a binomial model is justified for each count. First, the number of sixes in 12 rolls of a fair die. Second, the number of days in one week on which a particular commuter arrives late. Third, the number of rolls of a fair die needed to get the first six.
Show the answer

The first count is binomial. The number of rolls is fixed at 12, the rolls are independent and each gives a six with probability 16\tfrac16, so the count is Binomial⁡(12,16)\operatorname{Binomial}(12, \tfrac16) with mean 22.

The second count is made of yes and no outcomes, but nothing guarantees that the days are independent or share one probability of lateness. Late days can cluster, for example during a week of roadwork, and Mondays may differ from Fridays. A binomial model would need evidence for both conditions.

The third count is not binomial. The number of rolls is the random quantity being recorded, so there is no fixed number of trials whose successes are counted.

  1. A club roster lists 12 members, 4 of whom are volunteers. Three members are chosen without replacement, with every set of three equally likely. An analyst uses Binomial⁡(3,13)\operatorname{Binomial}(3, \tfrac13) and reports the probability of choosing no volunteers as (23)3=827≈0.296(\tfrac23)^3 = \tfrac{8}{27} \approx 0.296. Which condition fails, and what is the correct probability?
Show the answer

The draws are not independent. If the first member chosen is not a volunteer, the second is a volunteer with probability 411\tfrac{4}{11}, not 412\tfrac{4}{12}. The count is hypergeometric with N=12N = 12, K=4K = 4 and n=3n = 3. No volunteers means three of the eight other members, so

P(H=0)=(83)(123)=56220=1455≈0.2545.\begin{aligned} P(H = 0) &= \frac{\binom{8}{3}}{\binom{12}{3}} = \frac{56}{220} \\[0.4em] &= \frac{14}{55} \approx 0.2545. \end{aligned}

Both models give a mean of 11 volunteer, but the hypergeometric variance is 3⋅13⋅23⋅911=611≈0.5453 \cdot \tfrac13 \cdot \tfrac23 \cdot \tfrac{9}{11} = \tfrac{6}{11} \approx 0.545, smaller than the binomial 23\tfrac23.

How this lesson connects