CUPED and Covariate Adjustment
Technical documentation for variance reduction using pre-experiment data. This page covers the mathematical foundations, statistical assumptions, and regulatory considerations for implementing CUPED in clinical trials and A/B testing.
Contents
1. Theoretical Foundation
CUPED (Controlled-experiment Using Pre-Experiment Data) is a specific application of ANCOVA-based covariate adjustment. While popularized in tech by Deng et al. (2013)[1], its roots lie in classical experimental design (Fisher, 1935)[7]. Zetyra implements this to reduce variance by leveraging pre-randomization measures to account for baseline subject heterogeneity.
Mathematical Formulation
The adjustment implemented in Zetyra:
is mathematically equivalent to the OLS regression[1]:
Where:
- • is the treatment assignment (0 or 1)
- • is the centered baseline covariate
- • represents the treatment effect
- • is the optimal adjustment coefficient
Why These Are Equivalent
Zetyra uses the adjustment formula for computational efficiency, but the interpretation is identical to including as a covariate in your ANCOVA model.
2. Assumptions & Diagnostics
For the variance reduction estimates to be valid and unbiased, the following conditions must be met:
Linearity
The relationship between the covariate () and the outcome () must be approximately linear.
How to check: Plot vs . If relationship is curved, consider:
- Log-transforming the covariate
- Using polynomial terms ()
- Stratified CUPED (separate by subgroup)
Independence
The covariate must be measured prior to randomization to ensure it is independent of treatment assignment (), preserving the Type I error rate.
How to verify: Check that was measured before randomization in your data collection timestamps. Post-randomization covariates can introduce bias.
Homoscedasticity
Residual variance should be constant across the range of the covariate.
How to check: Plot residuals vs fitted values. If variance increases with , consider robust standard errors or variance-stabilizing transformations.
Missing Data
Zetyra's current implementation assumes covariates are available for all subjects.
What to do: For trials with missing baseline data, use mean imputation or exclude subjects only if the “Missing at Random” (MAR) assumption holds. Document your approach in the SAP.
What happens when assumptions are violated? Mild violations typically result in underestimated variance reduction (conservative). Severe violations can lead to biased treatment effect estimates. Yang & Tsiatis (2001) showed that in RCTs, linear adjustment remains robust even with mild misspecification[3].
3. Binary Endpoints: Logistic CUPED
For binary outcomes , linear CUPED can produce adjusted proportions outside . Zetyra uses logistic regression with G-computation to maintain valid probability bounds.
Implementation Steps
Fit logistic regression
Predict counterfactual outcomes
For each subject, predict outcomes under both treatment and control
Average predictions (G-computation)
Compute adjusted proportions:
Compute effect estimate
Adjusted risk difference, relative risk, or odds ratio
Why G-computation? Unlike simple logistic coefficient interpretation, G-computation provides marginal (population-averaged) effect estimates that are directly interpretable as adjusted proportions[5].
4. Regulatory Considerations (FDA & ICH)
CUPED adjustments in Zetyra are designed to align with FDA Guidance on Covariate Adjustment (2023) and ICH E9(R1).
Pre-specification Requirement
To satisfy regulatory scrutiny, the use of CUPED and the specific choice of covariate () must be documented in the Statistical Analysis Plan (SAP) prior to unblinding[2].
Type I Error Preservation
In randomized controlled trials (RCTs), linear adjustment for baseline covariates is generally robust and does not inflate Type I error, even if the model is slightly misspecified (Yang & Tsiatis, 2001)[3].
Documentation for SAP
Your SAP should include:
- The specific covariate(s) to be used
- Justification for covariate selection
- The adjustment method (linear CUPED vs. logistic)
- Handling of missing covariate data
5. Covariate Selection Guidelines
Choosing the right covariate is critical for maximizing variance reduction. The correlation between and determines effectiveness.
Best Practice Hierarchy
Same metric, pre-period
Use baseline revenue to adjust trial revenue. Typically .
Closely related metrics
Use baseline engagement to adjust conversion. Typically .
Stratification variables
Use demographic covariates when pre-period data unavailable. Lower .
How Many Covariates?
Start with one strong covariate. Adding multiple covariates yields diminishing returns and risks overfitting. If using multiple covariates, consider ridge regression or pre-specified variable selection[6].
Estimating from Historical Data
- Use data from 2+ weeks before trial start
- Calculate correlation between pre/post periods
- Conservative planning: Use for sample size calculations
6. Sample Size Reduction
With CUPED, required sample size scales by . This determines how many fewer subjects you need compared to an unadjusted analysis.
| Correlation () | Variance Reduction | Subjects Saved* | Typical Use Case |
|---|---|---|---|
| 0.3 | 9% | ~10% | Demographic covariates |
| 0.5 | 25% | ~33% | Related metrics |
| 0.7 | 49% | ~50% | Same metric, pre-period |
| 0.9 | 81% | ~80% | Highly stable outcomes |
* Subjects saved = . For example, 25% variance reduction means you need fewer subjects.
Planning Recommendation: Estimate from pilot data or historical trials, then use Zetyra's calculator with conservative () assumption to account for uncertainty.
7. Limitations & When Not to Use CUPED
CUPED provides minimal benefit in certain scenarios. Consider alternative methods when these conditions apply:
New Users
No historical data exists (e.g., onboarding experiments, first-time visitors). Alternative: Stratified randomization by acquisition channel.
Rare Events
Binary outcomes with <5% base rate have limited pre-period signal. Alternative: Post-stratification or Bayesian methods.
Short Time Windows
Less than 7 days of pre-period data yields unstable estimates. Alternative: Extend pre-period or use different covariates.
Low Correlation
provides <9% variance reduction—often not worth the complexity. Alternative: Standard analysis with larger sample size.
| Scenario | CUPED Benefit | Recommended Alternative |
|---|---|---|
| New user experiments | None | Stratified randomization |
| Rare events (<5%) | Minimal | Bayesian methods |
| <7 days pre-period | Unreliable | Extend observation window |
| <9% | Standard analysis |
8. Validation & Benchmarking
Zetyra calculations are benchmarked against industry-standard software to ensure regulatory-grade accuracy.
Continuous Endpoint Validation
| Parameter | Value | Parameter | Value |
|---|---|---|---|
| Alpha () | 0.05 | Effect () | 2.0 |
| Power () | 0.80 | Std Dev () | 25 |
| Correlation () | 0.70 | Allocation | 1:1 |
Unadjusted N
2,453
PASS 2024
1,252
Zetyra
1,252
Reduction
49%
Binary Endpoint Validation
| Parameter | Value | Parameter | Value |
|---|---|---|---|
| Control rate () | 10% | Treatment rate () | 12% |
| Covariate | Baseline conversion | Correlation () | 0.50 |
Unadjusted N
6,416
PASS 2024
4,812
Zetyra
4,812
Reduction
25%
9. API Quick Reference
Key Parameters
| Parameter | Type | Description |
|---|---|---|
| baseline_mean | float | Expected baseline mean (required) |
| baseline_std | float | Expected standard deviation (required) |
| mde | float | Minimum detectable effect (required) |
| correlation | float | Pearson correlation (or provide csv_data) |
| alpha, power | float | Defaults: 0.05, 0.80 |
Key Response Fields
adjusted_sample_size— CUPED-adjusted sample sizesample_size_reduction_pct— Percentage reduction from baselinevariance_reduction_factor— 1 - ρ² variance multiplierdays_saved_estimate— Estimated experiment days saved
10. References
- [1]Deng, A., Xu, Y., Kohavi, R., & Walker, T. (2013). Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-experiment Data. Proceedings of WSDM. PDF
- [2]U.S. Food and Drug Administration (2023). Adjusting for Covariates in Randomized Clinical Trials for Drugs and Biological Products: Guidance for Industry. PDF
- [3]Yang, L., & Tsiatis, A. A. (2001). Efficiency study of estimators for a treatment effect in a pretest-posttest trial. The American Statistician, 55(4), 314-321.
- [4]ICH E9 (1998). Statistical Principles for Clinical Trials. PDF
- [5]Benkeser, D., et al. (2020). Improved small-sample estimation of nonlinear cross-validated prediction metrics. Journal of the American Statistical Association.
- [6]Moore, K. L., & van der Laan, M. J. (2009). Covariate adjustment in randomized trials with binary outcomes. Statistics in Medicine, 28(1), 39-64.
- [7]Fisher, R. A. (1935). The Design of Experiments. Oliver and Boyd.
Ready to calculate?
Apply these methods with Zetyra's CUPED calculator.