CUPED
How Statsig Warehouse Native uses CUPED variance reduction to improve experiment sensitivity by adjusting for pre-experiment user behavior on metrics.
CUPED (Controlled-experiment Using Pre-Existing Data) reduces a metric's variance by adjusting each user's metric value with the same metric measured before that user's exposure. Statsig defines this pre-exposure window per user, not as a fixed window before the experiment starts for all users. The adjustment increases confidence in experiment metrics and reduces pre-exposure bias, for example when groups were randomly different before you applied any treatment. Statsig applies CUPED automatically to Warehouse Native experiments.
On Warehouse Native, you set the length of the pre-exposure window. Statsig recommends 7 days, the window Statsig Cloud always uses. For how CUPED fits with Statsig's other variance reduction options, refer to Variance reduction.
When a metric's own pre-exposure history isn't enough, such as in new-user experiments or for metrics that aren't autocorrelated, use CURE, which extends CUPED with additional covariates.
CUPED for simple aggregations
The original Microsoft paper describes the methodology for simple aggregations, as does Statsig's in-depth CUPED article.
On Warehouse Native, units with no pre-exposure value for a metric keep their unadjusted values. Statsig doesn't reweight them, and leaving them unadjusted doesn't bias the result.
CUPED for ratio metrics
The Microsoft paper also describes how to implement CUPED for metrics with a different analysis unit (Appendix B). Statsig extends this methodology to ratio metrics, where a numerator and a denominator represent each experiment unit. The variance reduction process finds the variance of the experiment data, the variance of the pre-exposure data, and the covariance between the two.
Denote the numerator, denominator, pre-exposure numerator, and pre-exposure denominator of a unit as , , , and , respectively. Using the CUPED-reduced variance formula,
where Statsig finds optimal as
expanded to
This gives the following, where is the expected pre-exposure ratio :
Because is hard to derive and the expectation term is the same for both groups, Statsig substitutes for . This transforms the two formulas into the following:
Using the optimal , Statsig reduces group-level variance by applying the parameter to calculate the adjustment. An across-group doesn't necessarily reduce the variance for one group, or the sum of variances of all groups, but in most cases it does. Simulations show that 98.3% of metrics saw a decrease through CUPED.
Statsig applies the CUPED-reduced variance when all of the following are true:
- The core assumptions of the CUPED model hold. Rounding error or other data artifacts can violate them:
- The pooled variance of the adjusted population across groups is less than the variance of the unadjusted population.
- More than 100 units have pre-exposure values.
- More than 5% of units have pre-exposure values.
Was this helpful?
For AI agents: a documentation index is available at /llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.