Skip to content

Testing for heterogeneity #963

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

Open
carl-offerfit opened this issue Mar 31, 2025 · 0 comments
Open

Testing for heterogeneity #963

carl-offerfit opened this issue Mar 31, 2025 · 0 comments

Comments

@carl-offerfit
Copy link

I read about the following "simple test" for heterogeneity in Athey & Wager 2019 (Estimating Treatment Effects with Causal Forests: An Application). : "A first, simple approach to testing for heterogeneity involves grouping observations according to whether their out-of-bag CATE estimates are above or below the median CATE estimate, and then estimating average treatment effects in these two subgroups separately using the doubly robust approach. This procedure is somewhat heuristic, as the "high" and "low" subgroups are not independent of the scores used to estimate the within-group effects; however, the subgroup definition does not directly depend on the outcomes or treatments (Yi;Wi) themselves, and it appears that this approach can provide at least qualitative insights about the strength of heterogeneity."

In econml, do you think this code snippet correctly implements this heuristic test?

ate_overall = econml_model.ate(X, T0=T0, T1=T)
ate_interval = econml_model.ate_interval(X, T0=T0, T1=T)
effects = econml_model.effect(X=X, T0=T0, T1=T)
median_effect = np.median(effects)
above_median = effect > median_effect
below_median = ~above_median
ate_above = econml_model.ate(
    X.loc[above_median, :],
    T0=T0.loc[above_median, :],
    T1=T.loc[above_median, :],
)
ate_below = econml_model.ate(
    X.loc[below_median, :],
    T0=T0.loc[below_median, :],
    T1=T.loc[below_median, :],
)

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant