Repository navigation
BUG/ENH: apply consistent propensity score clipping in TreatmentEffect - #10223
Merged
Merged
Conversation
Point estimates used unclipped predicted probabilities while the GMM moment conditions clipped them, with different bounds across estimators (0.01/0.99 in _IPWGMM and _AIPWGMM, 0.001/0.999 in _AIPWWLSGMM and _IPWRAGMM). With poor overlap this made results depend on return_results and on the chosen method's hidden bounds. Clip prob_select once in TreatmentEffect.__init__ and use the same bounds, exposed as the ps_bounds keyword (default (0.001, 0.999)), in all GMM moment conditions.
bashtage
requested changes
Sep 1, 2026
bashtage
left a comment
Member
There was a problem hiding this comment.
We almost always use array_like over tuples, the convert to np.array internally and work from these to know we have sanitized input.
bashtage
approved these changes
Sep 1, 2026
Member
|
Thanks for this. |
4 of 5 tasks
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Oct 5, 2026
statsmodelsGH-10223 added ps_bounds, which clips the propensity score in the point estimates and in the moment conditions of the GMM of ipw, aipw, aipw_wls and ipw_ra, and checks the bounds. The only test that sets the bounds compares the point estimates of aipw and aipw_wls with DoubleML. Add tests - that the GMM stays at the point estimates for bounds that clip more than 40% of the propensity scores, for the four estimators and the three effect groups, and that the bounds change the estimates. Replacing the clipping in the moment conditions of one of the estimators by the default bounds fails the three cases of that estimator. - of the error for bounds that do not satisfy 0 < lower < upper < 1 and for bounds that do not have two elements. Follow-up to statsmodelsGH-10223 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10222
Point estimates used unclipped predicted probabilities while the GMM moment conditions clipped them, with different bounds across estimators (0.01/0.99 in _IPWGMM and _AIPWGMM, 0.001/0.999 in _AIPWWLSGMM and _IPWRAGMM). With poor overlap this made results depend on return_results and on the chosen method's hidden bounds.
Before (issue repr):
ipw ATE, return_results=False: -0.3404 # unclipped
ipw ATE, return_results=True : 1.1391 # GMM re-solves with clipped probs
After:
Both return -0.15
Clip prob_select once in TreatmentEffect.init and use the same bounds, exposed as the ps_bounds keyword (default (0.001, 0.999)), in all GMM moment conditions. The default (0.001, 0.999) matches the previous aipw_wls/ipw_ra behavior. Users can pass ps_bounds=(0.01, 0.99) to reproduce the previous ipw/aipw GMM behavior.
Note on scope: this PR fixes internal consistency, not correctness under poor overlap. In the repro the true ATE is 1.0
after the fix both code paths agree on −0.15, but that estimate is still badly biased because 550+ observations have propensity scores outside the bounds and clipping merely caps their weights
AI Disclosure
Tool(s): Claude
Used for: drafting an implementation
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.