Problem
A search team at a travel marketplace assigns variants per visitor, but measures ranking quality (booking MAP, NDCG) per ranking request. One visitor can search for the same destination many times, so requests of one visitor are correlated and the independence assumption of the usual t-test fails. Standard errors come out too small and p-values too low, so the team calls results significant when they are not. False positives then reach product decisions.
Example from the article: a traveler searches "things to do in Rome" several times in a week from a phone and a laptop. All these requests belong to one variant.
Solution in brief
Keep the request-level metric and the usual t-test shape, but write the test as a regression of the metric on a treatment dummy and compute clustered standard errors with visitors as clusters. This widens the confidence intervals to match the real number of independent units. The delta method gives the same answer; the author picked clustering because it fits the existing t-test pipeline.
Questions this case answers
- How to compute valid confidence intervals when the randomization unit (user) differs from the analysis unit (repeated observation) and observations of one user are correlated
- How to compute valid significance when users are randomized but the ranking metric is measured per search request?
- How to avoid false positives in a search A/B test where one visitor generates many correlated requests?
- How to choose between clustered standard errors and the delta method for a hierarchical experiment readout?
Tools and methods
- Clustered standard errors — correct the standard error for correlation within a visitor.
- t-test as linear regression — carries the clustering fix without changing the metric.
- statsmodels —
olswithcov_type='cluster'for small data. - Apache Spark (PySpark) — reimplementation of the same algorithm for large volumes.
- Delta method, bootstrap — alternatives for the same problem.
Google or a one-time email code. No password.