Created
June 26, 2020 03:24
-
-
Save stasSajin/cf9dacd5dac9a2e3b4ada986e6c1c180 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def estimate_cuped(df): | |
# estimate the theta that minimizes the control variate | |
theta = df.cov().loc["income", "minutes"] / df.cov().loc["income", "income"] | |
y_new = df.minutes - theta * df.income | |
return y_new[df[group == 1]].mean() - y_new[df[group == 0]].mean() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment