TECHNOLOGIESTieInn Technologies

A/B testing

Statistics · 13 questions

Short notes

Key idea

An A/B test splits users at random into two groups, shows each a different version and compares one main metric. Random assignment is what lets you say the change caused the difference.

Syntax

  1. Hypothesis and one primary metric (conversion rate).
  2. Sample size from the baseline rate, the smallest lift you care about, α = 0.05 and power = 0.8.
  3. Randomise by user, run full weeks, don't stop early.
  4. Test: two-proportion z-test or chi-square; report the lift with a confidence interval.
from statsmodels.stats.proportion import proportions_ztest
proportions_ztest([conv_b, conv_a], [n_b, n_a])

Example

A: 500 of 10,000 convert (5.0%). B: 580 of 10,000 (5.8%). p ≈ 0.01, so B's lift of 0.8 points is unlikely to be chance. Check guardrail metrics like refunds before shipping.

Traps

  • Peeking and stopping when p < 0.05 inflates false positives.
  • Sample ratio mismatch (a 50/50 split that came out 52/48) means the split is broken.
  • Too many metrics: one of them will "win" by chance.
  • Novelty effect: users click new things at first; run long enough.

Want the full lesson with step-by-step examples, a project and a certificate? Statistics course, ₹120 →

Questions

Open in Code Lab5 free questions
5 questions

    A/B testing

  1. Question 1easy

    Why must users be assigned to A or B randomly?

  2. A/B testing

  3. Question 2medium

    A PM checks the test every morning and stops it the first day p < 0.05. What's wrong?

  4. A/B testing

  5. Question 3medium

    Which is the best unit to randomise for a checkout-page test?

  6. A/B testing

  7. Question 4medium

    What does this print?

    p_a = 120 / 2400
    p_b = 156 / 2400
    print(round((p_b - p_a) / p_a, 2))
  8. A/B testing

  9. Question 5hard

    What does this print?

    import math
    n_a = n_b = 2400
    p_a, p_b = 120 / n_a, 156 / n_b
    p = (120 + 156) / (n_a + n_b)
    se = math.sqrt(p * (1 - p) * (1 / n_a + 1 / n_b))
    print(abs((p_b - p_a) / se) > 1.96)

8 more questions on this topic, with hints, and tests

Sign up free for 21 days of every question and test.