Skip to content

BUG/ENH: apply consistent propensity score clipping in TreatmentEffect - #10223

Merged
bashtage merged 2 commits into
statsmodels:mainfrom
kirilklein:fix/teffects-ps-clipping
Sep 1, 2026
Merged

bashtage merged 2 commits into
statsmodels:mainfrom
kirilklein:fix/teffects-ps-clipping

Conversation

@kirilklein

Copy link
Copy Markdown
Contributor

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

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    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.

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 bashtage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We almost always use array_like over tuples, the convert to np.array internally and work from these to know we have sanitized input.

@kirilklein
kirilklein requested a review from bashtage September 1, 2026 15:16
@bashtage
bashtage merged commit 136508c into statsmodels:main Sep 1, 2026
13 checks passed
@bashtage

bashtage commented Sep 1, 2026

Copy link
Copy Markdown
Member

Thanks for this.

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]>
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

Successfully merging this pull request may close these issues.

BUG: TreatmentEffect: inconsistent hidden propensity-score clipping: point estimates and GMM inference use different probabilities

2 participants