Refutation of DML IRM inference
We will use DGP from Causalis. Read more at https://causalis.causalcraft.com/articles/generate_obs_hte_26_rich
| y | d | tenure_months | avg_sessions_week | spend_last_month | age_years | income_monthly | prior_purchases_12m | support_tickets_90d | premium_user | mobile_user | urban_resident | referred_user | m | m_obs | tau_link | g0 | g1 | cate | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0.000000 | 0.0 | 28.814654 | 1.0 | 77.936767 | 50.234101 | 1926.698301 | 1.0 | 2.0 | 1.0 | 1.0 | 1.0 | 0.0 | 0.045453 | 0.045453 | 0.089095 | 8.137981 | 9.142395 | 1.004414 |
| 1 | 80.099611 | 1.0 | 25.913345 | 3.0 | 53.777740 | 28.115859 | 5104.271509 | 3.0 | 0.0 | 1.0 | 1.0 | 0.0 | 1.0 | 0.041514 | 0.041514 | 0.246679 | 60.459257 | 78.817307 | 18.358049 |
| 2 | 6.400482 | 1.0 | 24.969929 | 10.0 | 134.764322 | 22.907062 | 5267.938255 | 8.0 | 3.0 | 0.0 | 1.0 | 1.0 | 0.0 | 0.052593 | 0.052593 | 0.162968 | 7.712855 | 9.138577 | 1.425723 |
| 3 | 2.788238 | 0.0 | 40.655089 | 5.0 | 59.517074 | 31.970490 | 6597.327018 | 3.0 | 2.0 | 1.0 | 1.0 | 1.0 | 0.0 | 0.036221 | 0.036221 | 0.188755 | 25.386510 | 31.159932 | 5.773422 |
| 4 | 0.000000 | 0.0 | 18.560899 | 3.0 | 74.370930 | 39.237248 | 4930.009628 | 5.0 | 1.0 | 1.0 | 1.0 | 0.0 | 0.0 | 0.036343 | 0.036343 | 0.174757 | 15.359250 | 18.600227 | 3.240977 |
CausalData(df=(100000, 13), treatment='d', outcome='y', confounders=['tenure_months', 'avg_sessions_week', 'spend_last_month', 'age_years', 'income_monthly', 'prior_purchases_12m', 'support_tickets_90d', 'premium_user', 'mobile_user', 'urban_resident', 'referred_user'])
Inference
| value | |
|---|---|
| field | |
| estimand | ATTE |
| model | IRM |
| value | 11.9222 (ci_abs: 7.3425, 16.5018) |
| value_relative | 25.5928 (ci_rel: 15.5972, 35.5885) |
| alpha | 0.0500 |
| p_value | 0.0000 |
| is_significant | True |
| n_treated | 4949 |
| n_control | 95051 |
| treatment_mean | 58.5062 |
| control_mean | 76.0871 |
| time | 2026-02-20 |
Overlap
What “overlap/positivity” means
Binary treatment : for all confounder values in your target population,
often strengthened to strong positivity: there exists an such that
Why it matters
-
Identification: Overlap + unconfoundedness are the two pillars that identify causal effects from observational data. Without overlap, the effect is not identified — you must extrapolate or model-specify what never occurs.
-
Estimation stability: IPW/DR estimators use weights
If is near 0 or 1, these weights explode, causing huge variance and fragile estimates.
- Target population: With trimming or restriction, you may change who the effect describes — e.g., ATE on the region of common support, not on the full population.
It's summary for overlap diagnostics
| metric | value | flag | |
|---|---|---|---|
| 0 | edge_0.01_below | 0.018540 | GREEN |
| 1 | edge_0.01_above | 0.000000 | GREEN |
| 2 | edge_0.02_below | 0.112650 | RED |
| 3 | edge_0.02_above | 0.000000 | RED |
| 4 | KS | 0.190677 | GREEN |
| 5 | AUC | 0.626645 | GREEN |
| 6 | ESS_treated_ratio | 0.464357 | GREEN |
| 7 | ESS_control_ratio | 0.997961 | GREEN |
| 8 | tails_w1_q99/med | 5.191133 | YELLOW |
| 9 | tails_w0_q99/med | 1.184178 | GREEN |
| 10 | ATT_identity_relerr | 0.012196 | GREEN |
| 11 | clip_m_total | 0.018540 | GREEN |
| 12 | calib_ECE | 0.005415 | GREEN |
| 13 | calib_slope | 0.671576 | YELLOW |
| 14 | calib_intercept | -0.907254 | RED |
edge_mass
edge_0.01_below, edge_0.01_above, edge_0.02_below, edge_0.02_above are shares of units whose propensity is below or above the percents
To keep in mind: DML IRM is clipping out the interval [0.02 and 0.98]
Huge shares are dangerous for estimation in terms of weights exploding
Flags in Causalis:
For : YELLOW if either side 0.02 (2%), RED if 0.05 (5%).
For : YELLOW if either side 0.05 (5%), RED if 0.10 (10%).
{'share_below_001': 0.01854, 'share_above_001': 0.0, 'share_below_002': 0.11265, 'share_above_002': 0.0, 'min_m': 0.00026454670780584426, 'max_m': 0.6376540197829689}
ks - Kolmogorov–Smirnov statistic
Here KS is the two-sample Kolmogorov–Smirnov statistic comparing the distributions of the propensities for treated vs control:
Interpretation:
- (D=0): identical distributions (perfect overlap).
- (D=1): complete separation (no overlap).
- Your value KS = 0.5116 means there exists a threshold (t) such that the share of treated with differs from the share of controls with by ~51 percentage points. That’s why it’s flagged RED (your thresholds mark RED when KS > 0.35): treatment assignment is highly predictable from covariates ⇒ poor overlap / strong confounding risk.
0.19067652887832237
AUC
Probability definition (most intuitive)
where is a score from a random positive and from a random negative. So AUC is the fraction of all positive–negative pairs that are correctly ordered by the score (ties get half-credit).
Rank / Mann–Whitney formulation
- Rank all scores together (ascending). If there are ties, assign average ranks within each tied block.
- Let be the sum of ranks for the positives.
- Compute the Mann–Whitney (U) statistic for positives:
- Convert to AUC by normalizing:
This is exactly what your function returns (with stable sorting and tie-averaged ranks).
ROC-integral view (equivalent)
If and trace the ROC curve as the threshold moves,
i.e., the geometric area under the ROC.
Properties you should remember
- Range: ; 0.5 = random ranking; 1 = perfect separation.
- Symmetry: .
- Monotone invariance: Any strictly increasing transform leaves AUC unchanged (only ranks matter).
- Ties: Averaged ranks ⇒ adds the term automatically.
In the propensity/overlap context
- A higher AUC means treatment (D) is more predictable from covariates (bad for overlap/positivity).
- For good overlap you actually want AUC close to 0.5.
0.6266454580150003
ESS_treated_ratio
Weights used
For ATE-style IPW, the treated-arm weights are
so on the treated subset the weights are simply .
Effective sample size (ESS)
Given the treated-arm weights (only for ),
This is exactly what _ess(w) computes.
- If all treated weights are equal, ESS (full efficiency).
- If a few weights dominate, ESS drops (information concentrated in few units).
The reported metric
This lies in . Near 1 ⇒ well-behaved weights; near 0 ⇒ severe instability.
Why it reflects overlap
When propensities approach 0 for treated units, weights explode → large CV → low ESS_treated_ratio. Hence this metric is a direct, quantitative read on how much usable information remains in the treated group after IPW.
{'ess_w1': 2298.1025570851816, 'ess_w0': 94857.16349432156, 'ess_ratio_w1': 0.4643569523308106, 'ess_ratio_w0': 0.9979607105061657}
tails_w1_q99/med
Interpretation
- It’s a tail-heaviness index for treated weights: how large the 99th-percentile weight is relative to a typical (median) weight.
- Scale-invariant: if you re-scale weights (e.g., Hájek normalization), both numerator and denominator scale equally, so the ratio is unchanged.
- Bigger heavier right tail more variance inflation for IPW (since variance depends on large ). It typically coincides with a low .
Edge cases & thresholds
- If or undefined, the ratio is not meaningful (your code returns “NA” in that case; with positive treated weights this is rare).
- Defaults: YELLOW if any of exceeds 10; RED if any exceed 100.
tails_w1_q99/medis one of these checks, focusing specifically on the 99th percentile.
Quick example
If and , then
indicating heavy tails and a likely unstable ATE IPW.
{'w1': {'q95': 54.954191239648, 'q99': 103.63534845395834, 'q999': 326.6877024294826, 'max': 1080.1560842371114, 'median': 19.963916032820617}, 'w0': {'q95': 1.126007261158915, 'q99': 1.2305275677823044, 'q999': 1.4996542994796511, 'max': 2.759793276583444, 'median': 1.0391406792873217}}
ATT_identity_relerr
With estimated propensities and :
- Left-hand side (controls odds sum):
- Right-hand side (treated count):
If and overlap is ok, LHS RHS.
You report the relative error:
(when otherwise it’s set to ).
How to read the number
- Small (e.g., ) ⇒ propensities are reasonably calibrated (especially on the control side) and ATT weights won’t be wildly off in total mass.
- Large ⇒ possible miscalibration of (e.g., over/underestimation for controls), poor overlap (many controls with inflating , or clipping/trimming effects.
Your default flags (same as in the code):
- GREEN if
- YELLOW if
- RED if
Quick intuition
The term is the odds of treatment. Summing that over controls should reconstruct the treated count. If it doesn’t, either the odds are off (propensity miscalibration) or the data lack support where you need it—both are red flags for ATT-IPW stability.
{'lhs_sum': 4888.639934058683, 'rhs_sum': 4949.0, 'rel_err': 0.012196416637970673}
clip_m_total
look at edge_mass
{'m_clip_lower': 0.01854, 'm_clip_upper': 0.0}
calib_ECE, calib_slope, calib_intercept
calib_ECE = 0.018 (GREEN)
Math: with 10 equal-width bins,
(weighted average gap between observed rate (\bar y_k) and mean prediction (\bar p_k) per bin). Result: ~1.8% average miscalibration → overall probabilities track outcomes well. Note the biggest bin error is in 0.5–0.6 (abs_error ≈ 0.162) but it’s tiny (95/10,000), so ECE stays low.
calib_slope (β) = 0.889 (GREEN)
Math (logistic recalibration):
Interpretation: (\beta<1) ⇒ predictions are a bit over-confident (too extreme); the optimal calibration slightly flattens them toward 0.5.
calib_intercept (α) = −0.107 (GREEN)
Math: same model as above; (\alpha) is a vertical shift on the log-odds scale. Interpretation: Negative nudges probabilities downward overall (your model is, on average, a bit high), consistent with bins like 0.5–0.6 where .
All three fall well within your GREEN thresholds, so calibration looks solid despite minor mid-range overprediction.
{'n': 100000, 'n_bins': 10, 'auc': 0.6266454580150003, 'brier': 0.046645568204131085, 'ece': 0.005414555766917116, 'reliability_table': bin lower upper count mean_p frac_pos abs_error 0 0 0.0 0.1 92701 0.040462 0.044045 0.003583 1 1 0.1 0.2 6411 0.131200 0.112463 0.018737 2 2 0.2 0.3 709 0.236655 0.172073 0.064582 3 3 0.3 0.4 135 0.337102 0.133333 0.203769 4 4 0.4 0.5 32 0.435279 0.093750 0.341529 5 5 0.5 0.6 8 0.559499 0.250000 0.309499 6 6 0.6 0.7 4 0.626106 0.000000 0.626106 7 7 0.7 0.8 0 NaN NaN NaN 8 8 0.8 0.9 0 NaN NaN NaN 9 9 0.9 1.0 0 NaN NaN NaN, 'recalibration': {'intercept': -0.9072535677540645, 'slope': 0.6715760602070323}, 'flags': {'ece': 'GREEN', 'slope': 'YELLOW', 'intercept': 'RED'}}
| bin | lower | upper | count | mean_p | frac_pos | abs_error | |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0.0 | 0.1 | 92701 | 0.040462 | 0.044045 | 0.003583 |
| 1 | 1 | 0.1 | 0.2 | 6411 | 0.131200 | 0.112463 | 0.018737 |
| 2 | 2 | 0.2 | 0.3 | 709 | 0.236655 | 0.172073 | 0.064582 |
| 3 | 3 | 0.3 | 0.4 | 135 | 0.337102 | 0.133333 | 0.203769 |
| 4 | 4 | 0.4 | 0.5 | 32 | 0.435279 | 0.093750 | 0.341529 |
| 5 | 5 | 0.5 | 0.6 | 8 | 0.559499 | 0.250000 | 0.309499 |
| 6 | 6 | 0.6 | 0.7 | 4 | 0.626106 | 0.000000 | 0.626106 |
| 7 | 7 | 0.7 | 0.8 | 0 | NaN | NaN | NaN |
| 8 | 8 | 0.8 | 0.9 | 0 | NaN | NaN | NaN |
| 9 | 9 | 0.9 | 1.0 | 0 | NaN | NaN | NaN |
Score
We need this score refutation tests for:
- Catch overfitting/leakage: The out-of-sample moment check verifies that the AIPW score averages to ~0 on held-out folds using fold-specific θ and nuisances. If this fails, your effect can be an artifact of leakage or overfit learners rather than a real signal.
- Verify Neyman orthogonality in practice: The Gateaux-derivative tests (orthogonality_derivatives) check that small, targeted perturbations to the nuisances (g₀, g₁, m) don’t move the score mean. Large |t| values flag miscalibration (e.g., biased propensity or outcome models) that breaks the orthogonality protection DML relies on.
- Assess finite-sample stability: The influence diagnostics reveal heavy tails (p99/median, kurtosis) and top-influential points. Spiky ψ implies high variance and sensitivity—often due to near-0/1 propensities, poor overlap, or outliers.
- ATTE-specific risks: For ATT/ATTE, only g₀ and m matter in the score. The added overlap metrics and trim curves show how reliant your estimate is on scarce, high-m controls—common failure mode for ATT.
| metric | value | flag | |
|---|---|---|---|
| 0 | se_plugin | 2.336587 | NA |
| 1 | psi_p99_over_med | 64.756207 | RED |
| 2 | psi_kurtosis | 3085.930676 | RED |
| 3 | max_|t|_g1 | 0.000000 | GREEN |
| 4 | max_|t|_g0 | 0.738424 | GREEN |
| 5 | max_|t|_m | 1.612125 | GREEN |
| 6 | oos_tstat_fold | -0.000196 | GREEN |
| 7 | oos_tstat_strict | -0.000196 | GREEN |
psi_p99_over_med
-
Let be the per-unit influence value (EIF score) for your estimator. We look at magnitudes .
-
Define the 99th percentile and the median of these magnitudes:
- The metric is the scale-free tail ratio:
Why this works (brief):
- Uses to ignore sign (only tail size matters).
- Dividing by the median makes it scale-invariant and robust to a few large values.
- Large values mean a small fraction of observations dominate uncertainty (heavy tails → unstable SE).
Quick read:
- : tails tame/stable
- : caution (heavy tails)
- : likely unstable; check overlap, trim/clamp propensities, or robustify learners.
{'se_plugin': 2.33658747572632, 'kurtosis': 3085.930675575231, 'p99_over_med': 64.7562071038307, 'top_influential': i psi m res_t res_c 0 67446 71506.706325 0.014464 4675.799768 0.000000 1 65005 64940.749295 0.017769 3408.282373 0.000000 2 3618 57509.364010 0.022839 2825.678117 0.000000 3 79652 -57249.417825 0.610355 0.000000 1808.738763 4 96126 53276.215692 0.052542 2509.536113 0.000000 5 48708 46302.067362 0.026377 2213.743705 0.000000 6 87181 43245.822176 0.059510 2246.844037 0.000000 7 56222 35052.876932 0.035378 1578.986396 0.000000 8 57635 34399.580082 0.074460 1855.306056 0.000000 9 47882 32356.549510 0.015467 1369.168501 0.000000}
psi_kurtosis
- Let be the per-unit influence values and define centered residuals
- Sample variance (with Bessel correction):
- Sample 4th central moment:
- The reported metric (raw kurtosis, not excess):
Interpretation (quick):
- Normal reference (excess kurtosis ).
- Much larger heavier tails / more extreme outliers.
- Rules of thumb used in the diagnostics: = caution, = severe.
{'se_plugin': 2.33658747572632, 'kurtosis': 3085.930675575231, 'p99_over_med': 64.7562071038307, 'top_influential': i psi m res_t res_c 0 67446 71506.706325 0.014464 4675.799768 0.000000 1 65005 64940.749295 0.017769 3408.282373 0.000000 2 3618 57509.364010 0.022839 2825.678117 0.000000 3 79652 -57249.417825 0.610355 0.000000 1808.738763 4 96126 53276.215692 0.052542 2509.536113 0.000000 5 48708 46302.067362 0.026377 2213.743705 0.000000 6 87181 43245.822176 0.059510 2246.844037 0.000000 7 56222 35052.876932 0.035378 1578.986396 0.000000 8 57635 34399.580082 0.074460 1855.306056 0.000000 9 47882 32356.549510 0.015467 1369.168501 0.000000}
, ,
We work with a basis of functions
Let be the clipped propensity (guards against division by zero).
ATE case
For each basis function , form a sample mean (Gateaux derivative estimator) and its standard error, then compute a t-statistic; finally take the maximum absolute value across bases.
direction
direction
direction
Interpretation: under Neyman orthogonality, each derivative mean should be approximately zero, so all should be small. Large values flag miscalibration of the corresponding nuisance.
ATTE / ATT case
Let and define the odds .
- The derivative is identically zero:
- direction
- direction
Rule of thumb: is “okay”; larger values indicate orthogonality breakdown — fix by recalibrating that nuisance, changing learners, features, or trimming.
| basis | d_g1 | se_g1 | t_g1 | d_g0 | se_g0 | t_g0 | d_m | se_m | t_m | |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0.0 | 0.0 | 0.0 | -0.010980 | 0.014869 | -0.738424 | -3.802089 | 12.314935 | -0.308738 |
| 1 | 1 | 0.0 | 0.0 | 0.0 | -0.001591 | 0.013315 | -0.119473 | -12.823242 | 23.914527 | -0.536211 |
| 2 | 2 | 0.0 | 0.0 | 0.0 | -0.001187 | 0.013974 | -0.084931 | -21.700341 | 38.284507 | -0.566818 |
| 3 | 3 | 0.0 | 0.0 | 0.0 | 0.000453 | 0.013133 | 0.034514 | -15.948031 | 27.507951 | -0.579761 |
| 4 | 4 | 0.0 | 0.0 | 0.0 | -0.005118 | 0.014957 | -0.342200 | -12.112879 | 15.384346 | -0.787351 |
| 5 | 5 | 0.0 | 0.0 | 0.0 | -0.001189 | 0.013786 | -0.086218 | -21.536865 | 29.004829 | -0.742527 |
| 6 | 6 | 0.0 | 0.0 | 0.0 | -0.001266 | 0.014546 | -0.087069 | -13.437196 | 16.311453 | -0.823789 |
| 7 | 7 | 0.0 | 0.0 | 0.0 | -0.010544 | 0.017775 | -0.593202 | 18.305941 | 11.355159 | 1.612125 |
| 8 | 8 | 0.0 | 0.0 | 0.0 | 0.006540 | 0.017810 | 0.367205 | -9.892706 | 7.936701 | -1.246451 |
| 9 | 9 | 0.0 | 0.0 | 0.0 | 0.010467 | 0.015084 | 0.693912 | -9.071946 | 10.246696 | -0.885353 |
| 10 | 10 | 0.0 | 0.0 | 0.0 | 0.003309 | 0.015068 | 0.219632 | -6.515310 | 11.636338 | -0.559911 |
| 11 | 11 | 0.0 | 0.0 | 0.0 | -0.003109 | 0.015489 | -0.200714 | -9.613623 | 13.281803 | -0.723819 |
oos_tstat_fold, oos_tstat_strict
Here’s the math behind the two OOS (out-of-sample) moment t-stats used in the diagnostics. Assume K-fold cross-fitting with held-out index sets (size ) and complements .
Step 1 — Leave-fold-out
For the moment condition , the leave-fold-out estimate used on fold is
Step 2 — Held-out scores on fold
Define the fold-specific held-out score for :
Compute per-fold mean and variance:
OOS t-stat diagnostics
A fold-aggregated, variance-weighted t-statistic:
Intuition: averages fold means and scales by a fold-pooled standard error.
A “strict” t-stat using every held-out observation directly:
Intuition: computes a single overall mean and standard error across all held-out scores (often slightly more conservative).
Interpretation
Under a valid design and correct cross-fitting (so that out-of-sample), both statistics are approximately standard normal:
Values near indicate that the moment condition holds out of sample. Large suggests overfitting, leakage, or nuisance miscalibration.
{'available': True, 'oos_tstat_fold': -0.00019613538740434564, 'oos_tstat_strict': -0.00019613466293191552, 'p_value_fold': 0.9998435066035664, 'p_value_strict': 0.9998435071816117, 'fold_table': fold n theta_minus_k psi_mean psi_var 0 0 20000 10.107551 9.073026 956612.184500 1 1 20000 12.516796 -2.973198 355816.110740 2 2 20000 11.546563 1.877966 551143.298220 3 3 20000 12.959614 -5.187289 541712.274267 4 4 20000 12.480716 -2.792798 325274.281795}
{'params': {'score': 'ATTE',
'trimming_threshold': 0.01,
'normalize_ipw': False},
'orthogonality_derivatives': basis d_g1 se_g1 t_g1 d_g0 se_g0 t_g0 d_m
0 0 0.0 0.0 0.0 -0.010980 0.014869 -0.738424 -3.802089
1 1 0.0 0.0 0.0 -0.001591 0.013315 -0.119473 -12.823242
2 2 0.0 0.0 0.0 -0.001187 0.013974 -0.084931 -21.700341
3 3 0.0 0.0 0.0 0.000453 0.013133 0.034514 -15.948031
4 4 0.0 0.0 0.0 -0.005118 0.014957 -0.342200 -12.112879
5 5 0.0 0.0 0.0 -0.001189 0.013786 -0.086218 -21.536865
6 6 0.0 0.0 0.0 -0.001266 0.014546 -0.087069 -13.437196
7 7 0.0 0.0 0.0 -0.010544 0.017775 -0.593202 18.305941
8 8 0.0 0.0 0.0 0.006540 0.017810 0.367205 -9.892706
9 9 0.0 0.0 0.0 0.010467 0.015084 0.693912 -9.071946
10 10 0.0 0.0 0.0 0.003309 0.015068 0.219632 -6.515310
11 11 0.0 0.0 0.0 -0.003109 0.015489 -0.200714 -9.613623
se_m t_m
0 12.314935 -0.308738
1 23.914527 -0.536211
2 38.284507 -0.566818
3 27.507951 -0.579761
4 15.384346 -0.787351
5 29.004829 -0.742527
6 16.311453 -0.823789
7 11.355159 1.612125
8 7.936701 -1.246451
9 10.246696 -0.885353
10 11.636338 -0.559911
11 13.281803 -0.723819 ,
'influence_diagnostics': {'se_plugin': 2.33658747572632,
'kurtosis': 3085.930675575231,
'p99_over_med': 64.7562071038307,
'top_influential': i psi m res_t res_c
0 67446 71506.706325 0.014464 4675.799768 0.000000
1 65005 64940.749295 0.017769 3408.282373 0.000000
2 3618 57509.364010 0.022839 2825.678117 0.000000
3 79652 -57249.417825 0.610355 0.000000 1808.738763
4 96126 53276.215692 0.052542 2509.536113 0.000000
5 48708 46302.067362 0.026377 2213.743705 0.000000
6 87181 43245.822176 0.059510 2246.844037 0.000000
7 56222 35052.876932 0.035378 1578.986396 0.000000
8 57635 34399.580082 0.074460 1855.306056 0.000000
9 47882 32356.549510 0.015467 1369.168501 0.000000},
'oos_moment_test': {'available': True,
'oos_tstat_fold': -0.00019613538740434564,
'oos_tstat_strict': -0.00019613466293191552,
'p_value_fold': 0.9998435066035664,
'p_value_strict': 0.9998435071816117,
'fold_table': fold n theta_minus_k psi_mean psi_var
0 0 20000 10.107551 9.073026 956612.184500
1 1 20000 12.516796 -2.973198 355816.110740
2 2 20000 11.546563 1.877966 551143.298220
3 3 20000 12.959614 -5.187289 541712.274267
4 4 20000 12.480716 -2.792798 325274.281795},
'flags': {'psi_tail_ratio': 'RED',
'psi_kurtosis': 'RED',
'ortho_max_|t|g1': 'GREEN',
'ortho_max|t|g0': 'GREEN',
'ortho_max|t|m': 'GREEN',
'oos_moment': 'GREEN'},
'thresholds': {'tail_ratio_warn': 10.0,
'tail_ratio_strong': 20.0,
'kurt_warn': 10.0,
'kurt_strong': 30.0,
't_warn': 2.0,
't_strong': 4.0},
'overall_flag': 'RED',
'meta': {'n': 100000,
'score': 'ATTE',
'used_estimator_psi': True,
'uses_custom_weights': False},
'summary': metric value flag
0 se_plugin 2.336587 NA
1 psi_p99_over_med 64.756207 RED
2 psi_kurtosis 3085.930676 RED
3 max|t|g1 0.000000 GREEN
4 max|t|g0 0.738424 GREEN
5 max|t|_m 1.612125 GREEN
6 oos_tstat_fold -0.000196 GREEN
7 oos_tstat_strict -0.000196 GREEN}
SUTVA
1.) Are your clients independent (i). Outcome of ones do not depend on others? 2.) Are all clients have full window to measure metrics? 3.) Do you measure confounders before treatment and outcome after? 4.) Do you have a consistent label of treatment, such as if a person does not receive a treatment, he has a label 0?
Those assumptions are statistically untestable. We need design of research for them
Unconfoundedness
| metric | value | flag | |
|---|---|---|---|
| 0 | balance_max_smd | 0.010351 | GREEN |
| 1 | balance_frac_violations | 0.000000 | GREEN |
balance\_max\_smd
For each covariate , the (weighted) standardized mean difference is
Group means and variances are computed under the IPW weights implied by your estimand:
- ATE: ,
- ATTE: ,
(If normalize=True, each weight vector is divided by its mean.)
Weighted means and variances:
Special cases in the code:
- If both variances are and ⇒
- If both variances are but means differ ⇒
- If denominator is otherwise ⇒
Then
implemented as a nanmax over the vector of .
NaNs are ignored; if any feature produced , the max is .
balance\_frac\_violations
Let the SMD threshold be (default ). Define the set of finite SMDs:
Then the fraction of violations is
So it’s the share of covariates whose weighted SMD exceeds the threshold, computed only over finite SMDs (NaN / Inf are excluded from the denominator).
Quick interpretation
- Smaller is better. A common rule of thumb is .
balance_max_smdtells you the worst residual imbalance across covariates.balance_frac_violationstells you how many covariates (as a fraction) still exceed the chosen threshold.
Sensitivity analysis
1) sensitivity_analysis: bias-aware CI
Goal. Start from your estimator with sampling standard error . Allow a controlled amount of worst-case hidden cofounding through three knobs . Inflate the uncertainty by an additive “max bias”.
Step A — Sampling part
- Point estimate , standard error , and for level .
- Usual sampling CI:
Step B — Cofounding geometry
The code pulls sensitivity elements from the fitted IRM:
-
: the asymptotic variance of the estimator’s EIF (so that in the module’s normalization).
-
: per-unit weight for the outcome channel (how outcome-model misspecification moves the EIF).
-
(“riesz_rep”): per-unit weight for the treatment channel (how propensity-model misspecification moves the EIF).
We turn the user’s sensitivity knobs into a quadratic budget for adversarial cofounding:
- : strength of unobserved outcome disturbance
- : strength of unobserved treatment disturbance
- : their correlation
This is a dimensionless bias multiplier — how sensitive the EIF is to those perturbations.
Step C — Max bias and intervals
Two equivalent forms appear in the code:
Then the module reports:
- Cofounding bounds for :
- Bias-aware CI (sampling + cofounding, worst-case additive):
(So you’re adding sampling error and the adversarial bias linearly for a conservative envelope.)
Notes & edge handling
- Numeric PSD clamping ensures ; is clipped to .
- If bias-aware CI collapses to the sampling CI.
- Internally, a delta-method IF for is
matching (used for coherent summaries).
2) sensitivity_benchmark: calibrating from omitted covariates
Goal.
Pick a set of candidate “omitted” covariates (the benchmarking_set).
Refit a short IRM that excludes and compare it to the long (original) model.
Use how well explains residual variation to derive plausible .
Step A — Long vs short estimates
- Long: (original model).
- Short: (drop , same learners/hyperparams).
- Report .
Step B — Residuals from the long model
Let be the outcome and propensity learners:
These are the EIF’s outcome and treatment residual components.
Step C — How much of each residual does explain?
Regress on and on (unweighted OLS; ATT case uses ATT weights):
- Obtain and .
- Convert to signal-to-noise ratios (the “strength” of cofounding channels):
(These are the same maps used in modern partial- robustness frameworks.)
Compute the correlation between the fitted pieces from those two regressions:
weighted for ATT when applicable, then clipped to .
Outputs
A one-row DataFrame (indexed by the treatment name) with
You can pass straight into sensitivity_analysis to get the associated bias-aware interval.
Intuitively, this calibrates how strong hidden stuff would need to be by using a concrete, observed proxy .
How to read them together
-
Use
sensitivity_benchmarkwith a plausible omitted set to derive and observe the actual estimate shift . -
Plug those into
sensitivity_analysisto get:
Small values (or ) ⇒ tiny ⇒ bias-aware CI near the sampling CI. Large values and widen it, reflecting stronger plausible hidden cofounding.
{'theta': 11.922156671701723, 'se': 2.3365874757263203, 'alpha': 0.05, 'z': 1.959963984540054, 'H0': 0.0, 'sampling_ci': (7.342529372550778, 16.501783970852667), 'theta_bounds_cofounding': (3.455971789602664, 20.38834155380078), 'bias_aware_ci': (-1.1816579084569545, 25.05171921299312), 'max_bias_base': 838.1523033278067, 'max_bias': 8.466184882099059, 'bound_width': 8.466184882099059, 'sigma2': 33645.29014705864, 'nu2': 20.879572757529697, 'rv': 0.014024838096781095, 'rva': 0.008684298340535173, 'params': {'r2_y': 0.01, 'r2_d': 0.01, 'rho': 1.0, 'use_signed_rr': False}}
| r2_y | r2_d | rho | theta_long | theta_short | delta | |
|---|---|---|---|---|---|---|
| d | 0.000208 | 0.04634 | 1.0 | 11.922157 | 13.553909 | -1.631752 |