CUPED - Controlled-experiment Using Pre-Existing Data
CUPED (short for Controlled-experiment Using Pre-Existing Data) is a technique which leverages user information from before an experiment to reduce the variance, and increase confidence in experimental metrics. This can help to debias experiments which have meaningful pre-exposure bias (e.g. the groups were randomly different before any treatment was applied).Our Cloud product uses a 7-day window for CUPED calculation. For Warehouse Native customers, a 7-day window is recommended, but you have the flexibility to customize it to any length.
The Microsoft paper also gives details on how to implement CUPED for those with a different analysis unit (Appendix B). On Statsig, we extend it to work for our ratio metrics, where each experiment unit is represented by a numerator and a denominator. The variance reduction process is performed by finding the variance of experiment data, pre-experiment data, and the covariance between the two.Denote the numerator, denominator, pre-experiment numerator, and pre-experiment denominator of a unit as Y, N, X, and M, respectively. Using the CUPED-reduced variance formula,Var(NcvYcv)=Var(NY)+θ2Var(MX)−2θCov(NY,MX)where optimal θ is found asVar(MX)Cov(NY,MX)expanded to
\Var(μMX−μM2μXM)Cov(μNY−μN2μYN,μMX−μM2μXM)At this point, we haveNc^Yc^=NcYc−θ(McXc−E[R])Nt^Yt^=NtYt−θ(MtXt−E[R])While E[R] is hard to deduct, we recognized that the expectation term is the same for both group. We decided to substitute E[R] with McXc so the formulas above are transformed to these following two:Ncv(control)Ycv(control)=N(control)Y(control)Ncv(test)Ycv(test):=N(control)Y(control)−(N(control)Y(control)−θM(control)X(control))+(N(test)Y(test)−θM(test)X(test)):=N(test)Y(test)−θM(test)X(test)+θM(control)X(control)Using the optimal θ, we are hoping to reduce group-level variance by plugging the parameter back in to calculate the adjustment. Please note that across-group θ does not necessarily reduce variance for one group, or the sum of variances of all groups, but in most cases it does. Our simulation shows that 98.3% of metrics saw a decrease by CUPED.Statsig will use CUPED variance when all of the following are met:
Core assumptions of the CUPED model are satisfied; this can be violated due to rounding error or other data artifacts
E(X_hat) = E(X)
The pooled variance of the adjusted population across groups is < the variance of the unadjusted population
Enough units have pre-experiment values (> 100)
Enough percentage of units have pre-experiment values (> 5%)