Simpson's paradox in an A/B test
Lazada ran a checkout test across mobile and desktop. Read the segments and treatment wins on both. Read the pooled total and control wins. Both readings are arithmetically correct — this is Simpson's paradox, and it happens when the segments have very different base rates *and* the variants aren't split evenly across them.
From segment_results, return one row per segment plus a final row labelled overall, each with control_rate and treatment_rate rounded to 4 decimal places. Order by segment, with overall last.
Schema
| segment | TEXT |
| variant | TEXT |
| users | INT |
| conversions | INT |
Basic
The example input, expected output, and walkthrough for this question unlock with a Basic plan.
Basic
The reference solution and walkthrough for this question unlock with a Basic plan.
Basic
This is a Basic question
Premium practice questions unlock with a Basic plan. The full solution, expected output, and grading are available to Basic members.
RM 25/mo · cancel anytime
The interviewer's next question
Instead of two separate rates, show the difference directly: for each segment plus an overall row, return segment and lift — treatment_rate minus control_rate, rounded to 4 decimals. Same row set and order as the main question.
Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.
See Basic plansRM 25/mo · cancel anytime
Show *why* the paradox happens: for each variant and segment, what share of that variant's total users landed in this segment? Return variant, segment, pct_of_variant (percentage, 1 decimal).
Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.
See Basic plansRM 25/mo · cancel anytime