MockDataLab

Data Science & Online Experiments

Online A/B testing: users × experiments (many-to-many), sessions → events

Four concurrent experiments, 1 500 users, and an exposures junction table that puts each user in one or two experiments with a randomized variant. Conversion depends on user propensity plus the experiment's true lift; revenue is log-normal with rare extreme values. Sessions and events hang off users.

experiments (4) ⟷ exposures ⟷ users (1 500); users → sessions (Poisson 3) → events (Poisson, duration-dependent)

Data structure

Experimentation data is the most common relational dataset in industry data science, and it needs a many-to-many link that most fake-data tools cannot express.

experimentsone row = one experiment
Name and the true lift on the conversion scale.
usersone row = one user
Country, platform, tenure and a latent conversion propensity on the logit scale.
exposuresone row = one user in one experiment
Junction table (user_id, experiment_id) with variant, conversion and revenue.
sessionsone row = one visit
Log-normal session duration in seconds.
eventsone row = one tracked event
Event type; the number of events grows with session duration.

Generate the a/b test analytics tables

The preset is a starting point: change any formula, noise step or row count and the preview, ER diagram and relation check update.

The relational generator loads as it scrolls into view…

Key relationships

  • converted = rbern(sigmoid(users.propensity + if(variant == "treatment", 10 * experiments.true_lift, 0)))

    A junction row reads both sides: users.* through the parent key and experiments.* through the link key.

  • events per session ~ Poisson(1 + duration_s / 60)

    Child row counts computed from a parent column.

  • revenue: outliers(p = 0.002, scale 20·SD) → clip(min 0)

    Rare whales dominate means, which is why teams use CUPED, winsorizing or quantile metrics.

Common pitfalls

  • Analysing per event or per session when randomization is per user: the unit of analysis must match the unit of randomization.
  • Ignoring interactions between concurrent experiments that share users.
  • Using a plain t-test on revenue without handling heavy tails.
  • Peeking at results daily and stopping as soon as p < 0.05.

Typical analysis

Per experiment: compare conversion between variants with a two-proportion test or logistic regression on user-level rows; for revenue use a bootstrap or a delta-method ratio metric, and adjust with pre-period covariates (CUPED).

SQL
-- runs on the SQLite export
SELECT x.experiment_id, x.variant,
       COUNT(*)         AS users,
       AVG(x.converted) AS conversion,
       AVG(x.revenue)   AS revenue_per_user
FROM exposures x
GROUP BY x.experiment_id, x.variant;

Further reading

  • Kohavi R, Tang D, Xu Y (2020). Trustworthy Online Controlled Experiments. Cambridge University Press.
  • Deng A, Xu Y, Kohavi R, Walker T (2013). Improving the sensitivity of online controlled experiments by utilizing pre-experiment data. WSDM 2013.

Other relational presets