KatInterview

Correct a Ratio Metric Confidence Interval Built on Wrong Assumptions

Statistics & ExperimentsModel answer
HardModel answerStatistics & Experimentsstatisticsconfidence intervalsdelta method

Last updated

Diagnose why a naively constructed CI for a ratio metric (revenue per session) is invalid and derive the correct interval using the delta method.

Setting

Your team ran an A/B test on a checkout flow. The primary metric is revenue per session (RPS):

$$\text{RPS} = \frac{\text{total revenue}}{\text{total sessions}}$$

A junior analyst computes a 95% confidence interval for the treatment group's RPS as follows:

  1. For each session, define r_i = revenue_i (0 for sessions with no purchase).
  2. Compute the sample mean: r̄ = total_revenue / n
  3. Compute the sample standard deviation of r_i: s
  4. Report CI: r̄ ± 1.96 * s / sqrt(n)

The treatment group has:

  • n = 40,000 sessions
  • Total revenue = $200,000 → r̄ = $5.00
  • Sample std dev of per-session revenue s = $48.00
  • Reported CI: $5.00 ± $0.47 → [$4.53, $5.47]

Your tasks:

  1. Is this CI correct? Identify any statistical assumption or structural issue.
  2. The analyst's manager suggests the real metric of interest is the ratio R = μ_revenue / μ_sessions where revenue and sessions are measured at the user level (a user may have multiple sessions). Explain why user-level aggregation matters and how it changes the problem.
  3. Using the delta method, derive the correct asymptotic CI for a ratio R = X̄ / Ȳ where X and Y are user-level totals. State all required quantities and the formula clearly.
  4. Given the following user-level summary statistics (treatment, m = 10,000 users), compute the 95% CI:
    • Mean sessions per user: ȳ = 4.0, Var(sessions per user): σ²_Y = 9.0
    • Mean revenue per user: x̄ = $20.00, Var(revenue per user): σ²_X = 38,400
    • Cov(revenue, sessions) per user: σ_XY = 120.0
  5. Compare the two CIs and explain which to use and when.

Hints

Hint 1

The session-level CI treats sessions as independent observations — think about what happens when one user contributes many sessions. What assumption does that violate?

Hint 2

The delta method linearizes a non-linear function of two means. Write R = X̄/Ȳ, then apply the first-order Taylor expansion around (μ_X, μ_Y) to get Var(R̂).

Hint 3

The delta method variance for X̄/Ȳ is (1/Ȳ²)[σ²_X + R²σ²_Y − 2R·σ_XY] / m. Plug in the numbers carefully — the covariance term can meaningfully shrink the variance.