Skip to main content

Worked Examples

Each example exposes the experiment, the derivation, a tempting wrong answer, and a transfer question. Attempt the transfer before reading the practice key.

1. The observation protocol changes the answer​

Model a two-child household as BB,BG,GB,GG, equally likely and ordered by age. Under the protocol "retain a household if at least one child is B," the retained outcomes are BB,BG,GB, so the probability both are B is 1/3.

Under a different protocol, sample one child uniformly from a household and observe B. The likelihood of this observation is 1 for BB, 1/2 for BG or GB, and 0 for GG. Unnormalized household weights are 1/4,1/8,1/8,0, summing to 1/2; the posterior for BB is (1/4)/(1/2)=1/2.

Neither protocol may be silently substituted for the other. A vague statement such as "someone tells you one child is B" is insufficient without a reporting rule. The simplified model assumes independent equiprobable B/G categories solely for this mathematical exercise.

Transfer: use three ordered independent fair coin flips. Compare "at least one head" with "a uniformly selected flip is head" when asking for three heads. Answers are in practice set A.

2. A detector's precision starts with its denominator​

Take 10,000 requests, prevalence .01, sensitivity .9, and false-positive rate .05. These are model expectations, not a claim that every random batch has exactly these counts.

Actual stateFlaggedUnflaggedTotal
Defective9010100
Nondefective4959,4059,900
Total5859,41510,000

Precision is 90/585 ≈ .153846; recall is 90/100=.9. Review volume is 585 expected flags. Dividing by 100 answers recall, not precision. Changing prevalence to .10 while keeping conditional detector rates fixed gives 900 true and 450 false flags, precision 2/3. That fixed-rate assumption itself needs checking under population drift.

Transfer: prevalence=.02, sensitivity=.8, false-positive rate=.04. Build the entire table before computing precision.

3. Stop on success: count opportunities, not just capacity​

At most three total attempts are allowed, with independent per-attempt failure p=.05. The terminal paths are S,FS,FFS,FFF, with probabilities .95,.0475,.002375,.000125. Their attempt counts are 1,2,3,3. Thus

E[attempts] = .95 + 2*.0475 + 3*(.002375+.000125) = 1.0525
E[failures] = 0*.95 + .0475 + 2*.002375 + 3*.000125 = .052625
E[backoffs] = E[attempts]-1 = .0525
P(success) = 1-.000125 = .999875

The indicator derivation generalizes: attempt j is reached with probability p^(j-1). Summing those probabilities yields the expected count without deriving a full PMF. At 20 ms per backoff, expected added waiting is 1.05 ms. A failure cost also charged after the final attempt would be a different variable.

The binomial answer 3*p=.15 counts failures among three trials that are all performed. A maximum is not a fixed sample size. Shared outages can invalidate the independent-attempt model even when the arithmetic is correct.

Transfer: p=.2, at most four total attempts, 50 ms per backoff. Derive all four summaries and waiting cost.

4. Sampling without replacement​

Uniformly draw four of ten machines, of which three are defective. There are 210 equiprobable unordered samples. To obtain k defective machines, choose k of the three defects and 4-k of the seven healthy machines:

P(X=k) = C(3,k)*C(7,4-k)/C(10,4)
k: 0 1 2 3 4
numerator: 35 105 63 7 0

These numerators sum to 210. The expectation by indicators is 4*(3/10)=1.2. Directly, E[X²]=(105+4*63+9*7)/210=2, giving variance 2-1.2²=.56. Binomial(4,.3) has the same mean but variance .84; draws without replacement are negatively dependent. Checking only the mean would miss the wrong model.

Transfer: two draws from six machines with two defects. Enumerate the unordered pairs and compare the variance with the binomial approximation.

5. A workload reversal without a causal conclusion​

The lab fixture gives A's small/large mean times as 10/100 ms, with 100/900 observations; B's as 12/110 ms, with 900/100 observations. Raw means are 91 and 21.8 ms, so B looks faster in aggregate despite being slower in both groups.

At a common 50/50 mix, A averages .5*10+.5*100=55 ms; B averages 61 ms. Standardization answers a specific workload-comparison question. It does not prove the version caused the difference: allocation, users, hardware, or time could confound it. The aggregate table lacks within-group variability, so it cannot support a numerical confidence interval. It also cannot supply p99 by averaging conditional p99 values.

Transfer: choose a target with 80% small requests. Compute both standardized means and describe the new estimand.

6. Coverage is a property of an interval procedure​

For n=1 and true p=.5, a Wald interval is [0,0] after a failure or [1,1] after a success. Neither contains .5, so its coverage is zero despite using a nominal 95% multiplier. This counterexample does not require Monte Carlo.

For larger n, sum the binomial probability of each count whose interval covers p. The lab does this for Wilson and Wald at n=20, then checks the result by independent simulations. The enumerated sum is exact under the model up to floating-point rounding; Wilson itself remains an approximate interval procedure.

Transfer: a procedure always reports [0,1]. What is its coverage, and why is coverage alone insufficient for a useful interval? Answer: coverage is one, but the interval provides no narrowing of the possible probability.