Data Analyst Interview
Menu
Browse in your language. All mock interviews, preparation sessions and feedback are in English only.
Practical learning resource

A/B Testing for Data Analysts

An A/B test compares randomly assigned groups to estimate a change’s effect. Define the outcome, sample size, duration and decision rule before examining results.

By Prakhar Shrivastava · Updated 16 September 2026

What makes an A/B test interpretable?

Start with a decision and a hypothesis. For a fictional checkout, the hypothesis might be that showing delivery costs earlier changes purchase completion. Define the primary metric as completed purchases per eligible user, specify the randomisation unit and assign each unit consistently.

Before launch, set the sample-size assumptions, minimum effect worth detecting, observation window and analysis method. Include guardrails such as errors or refund requests where relevant. Randomisation balances groups in expectation; it does not make every realised characteristic identical.

A reproducible conversion example

The following synthetic example compares two independent groups with one binary outcome per user. It uses a pooled two-proportion normal approximation for a two-sided null hypothesis of equal conversion rates. The counts are sufficiently large for this approximation; sparse outcomes may need a different method. This runs in Python 3 without extra packages.

from math import sqrt, erfc

n_control, x_control = 10000, 500
n_treatment, x_treatment = 10000, 580
p_control = x_control / n_control
p_treatment = x_treatment / n_treatment
pooled = (x_control + x_treatment) / (n_control + n_treatment)
se_null = sqrt(pooled * (1-pooled) * (1/n_control + 1/n_treatment))
z = (p_treatment - p_control) / se_null
p_value = erfc(abs(z) / sqrt(2))
print(f"Control: {p_control:.1%}; treatment: {p_treatment:.1%}")
print(f"Difference: {100*(p_treatment-p_control):.2f} percentage points")
print(f"Relative lift: {(p_treatment/p_control-1):.1%}")
print(f"z={z:.3f}; two-sided p={p_value:.4f}")

Control conversion is 5.0% and treatment conversion is 5.8%. The difference is 0.8 percentage points; relative lift is 16%. The two-sided p-value is approximately 0.0123. These are different quantities and should not share a label.

What does the p-value mean?

Under the null hypothesis and the test assumptions, the p-value is the probability of obtaining a test statistic at least as extreme as the observed one. It is not the probability that the null hypothesis is true, and it does not establish that a change will be profitable.

Report an effect estimate and a suitable uncertainty interval alongside the test. Investigate the cost and practical importance of the change. A small p-value can accompany an effect too small to justify implementation, and an inconclusive test is not proof of no effect.

The example assumes independent randomisation units. Repeated events from the same user, randomisation by team, or interference between users require care; counting correlated events as independent observations can overstate precision.

Checks before making a decision

Check the experiment population before comparing conversion

Count distinct randomization units in each variant and compare them with the planned allocation. A 50/50 design does not require identical counts, but an unexpectedly large imbalance warrants investigation. Check assignment logs, exposure events and exclusions before treating an observed conversion difference as a treatment effect.

Try the sample ratio mismatch check in Python: its synthetic 550-versus-450 example shows how to test the split and distinguish an allocation alert from a conversion-rate test. Passing that check does not establish that logging, outcomes or the entire experiment are valid.

  1. Verify assignment, exposure logging and the planned eligible population.
  2. Check whether each group received its intended experience.
  3. Use complete observation windows and inspect missing outcomes.
  4. Assess guardrail metrics and any material implementation incidents.
  5. Follow the planned stopping rule; repeated testing until a result becomes significant changes error behaviour.

If the experiment stopped after three days because the p-value looked good, do not simply treat it as a valid fixed-horizon result. Explain the stopping decision and use an analysis appropriate to the design.

Interview questions to practise

Would you ship a change with p = 0.03?

Not from that number alone. Check the design, effect size, uncertainty, duration, implementation quality and guardrails. State the decision criteria before recommending action.

Does a 16% lift mean 16 more conversions per 100 users?

No. In this example it means an increase from 5.0 to 5.8 conversions per 100 users: 0.8 percentage points. Relative lift divides that increase by the 5.0% baseline.

For the normal distribution functions, consult the SciPy reference. Continue with the business case studies and Python practice guide.

✉ WhatsApp