The adjusted metric keeps each user's distance from the line, plus the mean
Take 0.75, the line's slope, times each user's distance from the average x, and subtract it from y. adjust(y, x, theta) does that, and you write it at the end of this step:
Subtract 0.75 × (x - mean of x) from each y. What happens to the mean and the variance?
Pick one to see what it prints.
Each adjusted value is the mean, 6, plus that user's distance from the line: the treatment user at x=6 gets 6 + 2 = 8, and the control user there gets 6 - 1 = 5.
That's CUPED. It replaces Y with
Ycv=Y−θ(X−Xˉ)
In words: take each user's Y and subtract θ (theta) times how far their X sits from the average X, written Xˉ. θ is a number you choose. The best one is the line's slope, and the next chapter shows why. Then you run the same test on Ycv. The subscript stands for control variate, the Monte Carlo technique the paper borrows.
Here is the eight users' spread, before and after:
Each user's test-week sessions, raw and adjusted
mean 6
raw yvariance 4.5
adjustedvariance 1.125
246810
sessions
controltreatment
Read the formula as: keep only the surprise. The busy users came down and the quiet ones came up, so the eight values bunch around the same mean.
Three details decide whether it works, and each one is a line of the practice problem: the value of θ, centering X, and measuring X before the test.
In the editor, write adjust(y, x, theta): the formula, for any theta.
Pick an answer above to see the rest
Instructions
1
Write adjust(y, x, theta): Ycv=Y−θ(X−Xˉ) for arrays y and x of the same length and a given theta.