Problem
Glovo's data scientists often cannot assign treatment at the level where the metric is defined. A change to city settings, such as opening hours or the saturation level at which a city is blocked, applies to a whole city, while the outcomes (delivery time, order cancellation) are measured per order. Analyzing such an experiment as if orders were independent makes the standard errors far too small. The false positive rate ends up well above the nominal 5%, so an experiment can report an effect that does not exist.
Example from the article: testing a city's saturation threshold, with all orders in a city going to treatment or control and customer delivery time as the outcome.
Solution in brief
Treat the cities (or customers) as clusters. Randomize whole clusters, estimate the effect with the difference in means, and compute standard errors that allow correlation inside a cluster. A simulation on real order data shows that naive standard errors give a 44.2% false positive rate, against 5.1% for clustered ones.
Questions this case answers
- How to compute valid standard errors and test results when the randomization unit is an aggregate and outcomes are measured on the individual units inside it
- How to run an experiment without leakage between treated and control units when individual-level randomization lets them influence each other
- How to analyze an experiment where treatment is assigned per city but the metric is measured per order?
- How to randomize when users can pass information to each other and individual-level assignment would contaminate the control group?
Tools and methods
- Cluster-randomized experiment — assign treatment to whole groups (cities, customers) instead of single orders
- Clustered standard errors — standard errors that allow outcomes to correlate within a cluster, independent across clusters
- statsmodels — OLS with clustered covariance type, clusters given by city
- Null-effect simulation — repeated random assignment with no real effect, to check the false positive rate
Google or a one-time email code. No password.