Menu

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_results
segmentTEXT
variantTEXT
usersINT
conversionsINT

Basic

The example input, expected output, and walkthrough for this question unlock with a Basic plan.

↑ Read the question

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.

See Basic plans

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 plans

RM 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 plans

RM 25/mo · cancel anytime

Keep going

Company names are trademarks of their respective owners, used here only to describe practice material. mahir_data is not affiliated with, endorsed by, or sponsored by any company named on this site. Terms.