Basemath—GetYourGuide’s Way of Sequential Testing. Part II: The Theory

Alexander Weiss22 Mar 2024

Problem

Teams that check an A/B test every day want to stop it once the treatment is unlikely to reach a worthwhile effect. Classical sequential methods adjust the stopping boundary at every look, which needs numerical integration each time. The post gives the math behind Basemath, GetYourGuide's open-source sequential test. It fixes one straight boundary up front and bounds both error rates.

Example from the article: with a binary metric and a 20% bound on missed true uplifts, the share of uplift paths stopped by the boundary reaches 20% at the maximum sample size.

Solution in brief

Treat the cumulative difference between treatment and control as a random walk. Stop for futility when it falls below a straight line. Pick the line's intercept and the maximum sample size by solving one equation, so both error constraints hold. Between daily check-ins, stop with a coin flip whose probability is the chance the hidden path crossed the line.

Questions this case answers
  • How to stop a randomized experiment early when it is unlikely to reach the target effect, while guaranteeing bounded false-positive and false-negative rates under periodic data looks
  • How to choose a maximum sample size and a stopping boundary jointly so that both error constraints hold at once
  • How to stop an A/B test early for futility while keeping type I and type II error rates under control?
  • How to compute the maximum sample size and the futility boundary for a given significance level, power and minimal detectable effect?

Tools and methods

  • Random-walk model — the difference between variants as a random walk.
  • Linear futility boundary — stopping line with slope equal to the minimal detectable effect (MDE).
  • Numerical root finding — solves for the maximum sample size T.
  • Crossing-probability coin flip — handles daily check-ins.
  • O'Brien-Fleming spending function — share of true uplifts stopped by mistake.
Continue reading — it's free

Google or a one-time email code. No password.