Week 01 · Populations, samples, and statistics

Estimate a fixed population rate and explain why two samples disagree.

Watch on YouTube

Subject contents · Week 2 →

Estimate a fixed population rate and explain why two samples disagree.

Work through the problem

Suppose every request in a stable system independently has probability p = 0.30 of retrying. The population model describes all possible requests. One sample is a finite set of observed outcomes. The parameter p is fixed in this model. The statistic p̂ is computed from the sample and changes when the sample changes.

With five requests [1, 0, 0, 1, 0], p̂ = (1 + 0 + 0 + 1 + 0)/5 = 0.40. For a random sample of size n, linearity of expectation gives E[p̂] = (np)/n = p. An unbiased estimator can still miss in either direction on a particular day. If requests share an incident, the independent model may understate the variation.

Estimates from 5,000 samples of five. Histogram of estimated retry probability.

Estimates from 5,000 samples of five.

Run the Python lab

import numpy as np
rng = np.random.default_rng(12)
p = .30
rates = rng.binomial(1, p, size=(5000, 5)).mean(axis=1)
print("Observed estimate:", np.mean([1, 0, 0, 1, 0]))
print(f"Mean across samples: {rates.mean():.3f}")
assert abs(rates.mean() - p) < .02

Output from the lab

Observed estimate: 0.4
Mean across samples: 0.300

Practice

  1. In a sample with three retries out of ten, what are the parameter and statistic?

Check your reasoning

  1. The model parameter remains 0.30. The observed statistic is also 0.30 in this particular sample.

Subject contents · Week 2 →

Further reading · MIT 18.650 · Statistics for Applications