Skip to content

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

Closed

Description

@kirilklein

Describe the bug

Descripton

TreatmentEffect applies propensity-score clipping inconsistently across code paths (treatment/treatment_effects.py, current main):

Path Clipping
Point estimates: ipw/aipw/aipw_wls/ipw_ra via self.prob_select none
_IPWGMM.momcond, _AIPWGMM.momcond np.clip(p, 0.01, 0.99)
_AIPWWLSGMM.momcond, _IPWRAGMM.momcond np.clip(p, 0.001, 0.999)

Consequences:

(1) with return_results=True the GMM re-solves the moment conditions using clipped probabilities while the reported "start" estimate uses unclipped ones, so point estimate and inference can correspond to different propensity scores; (2) the clipping bounds differ across estimators for no documented reason; (3) none of this is documented or user-controllable.

Reproduction (0.14.6, numpy seed 0):

strong-overlap-violating DGP, true ATE = 1.0 — ipw(return_results=False) → −0.340; ipw(return_results=True) GMM ATE → 1.139. [full script attached]

Suggested fix:

clip once, consistently, at prob_select creation (or expose a ps_bounds/trim argument defaulting to the current GMM behavior), so estimates and SEs come from the same probabilities. Happy to submit a PR. Related follow-up I'd also like to contribute: overlap/balance diagnostics (teoverlap/tebalance analogues).

related: #2443, #8327

Code Sample, a copy-pastable example

import numpy as np
import statsmodels.api as sm
from statsmodels.treatment.treatment_effects import TreatmentEffect

rng = np.random.default_rng(0)
n = 2000
x = rng.normal(size=n)
p = 1 / (1 + np.exp(-3.5 * x))  # strong selection -> PS near 0 and 1
treat = rng.binomial(1, p)
y = 1.0 * treat + x + rng.normal(size=n)  # true ATE = 1.0

exog = sm.add_constant(x)
res_probit = sm.Probit(treat, exog).fit(disp=0)
ps = res_probit.predict()
print(f"propensity scores: min={ps.min():.2e}, max={ps.max():.10f}")
print(f"n below 0.01: {(ps < 0.01).sum()}, n above 0.99: {(ps > 0.99).sum()}")

te = TreatmentEffect(sm.OLS(y, exog), treat, results_select=res_probit)

ate_point = te.ipw(return_results=False)[0]
ate_gmm = te.ipw(return_results=True).results_gmm.params[0]
print(f"ipw ATE, return_results=False: {ate_point:.4f}")
print(f"ipw ATE, return_results=True : {ate_gmm:.4f}")

Expected Output

the two ATE lines should agree same estimator, same data, same call except return_results. They differ because return_results=False uses raw prob_select while _IPWGMM.momcond re-solves with np.clip(p, 0.01, 0.99).

Actual Output

propensity scores: min=1.45e-16, max=1.0000000000
n below 0.01: 271, n above 0.99: 283
ipw ATE, return_results=False: -0.3404
ipw ATE, return_results=True : 1.1391

Versions

0.15.0

Checklist

  • I have searched the issue tracker for a similar issue and did not find one.

  • I have confirmed this bug exists on the latest released version of statsmodels, or on the main branch.

Activity

  1. kirilklein commented on Sep 1, 2026

    @kirilklein
    ContributorAuthor

    I can take it

  2. bashtage commented on Sep 1, 2026

    @bashtage
    Member

    Happy to recieve a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions