-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPW weights bug. Missuse of np.average rather than mean of weighted outcomes #67
Comments
Additional information to this issue How the IPW is implemented as of now is not wrong per se. It is just another (better in most cases) way to implement IPW, the Hajek estimator. It reduces variance at the cost of bias (no free lunch) with respect to my proposal (Hortvitz-Thompson estimator) which is unbiased but normally leads to high variance. Maybe the package would be better if it implemented both and let the user decide. |
Hi Marco, I'll keep this issue open until solved. Thanks again. |
Note to self for contemplating an elastic-net-like solution for any combination between the Hájek and Horvitz–Thompson estimators a-la equation (1) from Khan and Ugander (2023). |
Sounds good. I will fork and make a pull request when I get a chance. That ENet aproach also looks interesting. Might be worth exploring a benchmark sudy on synthetic data ;). Best, |
Just made the pull request with my fork changes for the HT & Hajek IPW implementations. |
Hi,
I believe there is a mistake in the calculation of outcomes in IPW.
The code is using np.average to compute the expected outcome across treatment groups. This computation sums the weighted outcomes and normalizes by the sum of the weights which is incorrect for IPW:
sum(weights*y)/sum(weights)
Instead it should be the mean of the weighted outcomes:
sum(weights*y)/len(y)
This is an easy but important fix.
The text was updated successfully, but these errors were encountered: