KatInterview

Compare Two Proportions with Unequal, Clustered Samples

Statistics & ExperimentsModel answer
HardModel answerStatistics & Experimentsstatisticsconfidence intervalsclustering

Last updated

Construct and interpret a confidence interval for the difference in conversion rates when observations are clustered within groups, not independently drawn.

Setting

A product team runs a study across 40 retail stores. Half the stores (20) receive a redesigned checkout flow; the other half keep the original. Every customer who visits a store during the two-week window is tracked.

Summary data:

GroupStoresTotal customersConversions
Treatment208 4001 092
Control206 000660

A junior analyst computes a standard two-proportion z-interval for the difference in conversion rates and reports:

"The 95% CI for the lift is [+0.6 pp, +3.4 pp], p < 0.05. We should ship."

You are asked to review this analysis in a technical interview setting.

What is expected

  1. Identify the flaw in the analyst's approach and explain precisely why it matters here.
  2. Describe the correct method for constructing a confidence interval that accounts for the data structure. Be specific about the estimator and the variance formula you would use.
  3. Walk through the calculation using the cluster-level data below, and produce a corrected 95% CI. Show every step.
  4. Interpret the result and make a shipping recommendation with appropriate caveats.

Cluster-level conversion rates (store means)

Use these per-store rates to do your calculation. Assume the analyst computed them correctly.

Treatment stores (n = 20):
Mean store rate p̄_T = 0.1310, sample variance of store rates s²_T = 0.000784

Control stores (n = 20):
Mean store rate p̄_C = 0.1105, sample variance of store rates s²_C = 0.000625

(You do not need to recompute these from raw data.)

Hints

Hint 1

The standard two-proportion z-test assumes every observation is independent. Ask yourself: are two customers in the same store really independent? What does this violation do to the standard error?

Hint 2

The correct approach treats each store as one unit of observation. With 20 stores per arm, you have 20 independent data points per group, not 8,400 vs. 6,000. Build your CI around the distribution of store-level means.

Hint 3

For two independent groups with small, equal n, use the two-sample t-interval. The SE of the difference is sqrt(s²_T/n_T + s²_C/n_C). Degrees of freedom: n_T + n_C - 2 = 38, or use Welch if variances differ substantially.