1
Data preparation & sample construction
Source: BDHS 2022 Individual Recode (IR) file — BDIR81FL.SAV · DHS Phase 8
Exclusion sequence
30,078 women aged 15–49All interviewed respondents
→
28,537 currently marriedV501 = 1
→
11,528 extreme quintilesV190 ∈ {1, 5}
→
11,510 analytic sample−18 missing any covariate
Variable coding — all 10 variables
| Role | DHS variable | Label | Coding | Notes |
|---|---|---|---|---|
| Outcome (Y) | V312 | Modern contraceptive use | Binary: 1 = modern method; 0 = otherwise. Codes: 1,2,3,5,6,10,11,14 | DHS-8 standard definition |
| Exposure (A) | V190 | Household wealth quintile | Binary: 1 = richest (V190=5); 0 = poorest (V190=1) | Extreme quintiles only; middle 3 excluded |
| Covariate | V012 | Age in completed years | Continuous → standardised; grouped 15–24, 25–34, 35–49 for subgroup analysis | StandardScaler applied |
| Covariate | V106 | Educational attainment | 4 categories: none / primary / secondary / higher | DHS standard grouping |
| Covariate | V025 | Urban/rural residence | Binary: urban = 1, rural = 0 | |
| Covariate | V136 | Household size | Continuous → standardised | StandardScaler applied |
| Covariate | V201 | Parity (children ever born) | Continuous → standardised; capped at 10 | Strongest SHAP predictor (mean |ϕ| = 0.4113) |
| Covariate | V714 | Current employment status | Binary: employed = 1 | Proxy for economic independence |
| Covariate | V158 | Media exposure (TV) | Binary: any TV watching = 1 (V158 > 0; includes < once/week through almost every day) | FP message exposure proxy; note: code uses V158 > 0, capturing all non-zero response categories |
| Covariate | V632 | FP decision autonomy | Binary: woman has say = 1 (V632 ∈ {1, 2}) | Contraceptive autonomy proxy |
Preprocessing steps
- aAll continuous covariates (age, household size, parity) standardised to zero mean, unit variance using
sklearn.preprocessing.StandardScalerfitted on the full analytic sample before any stratum partitioning. - bClass imbalance handling: none applied. Outcome prevalence = 34.9%, which exceeds the commonly used 10–15% minority-class threshold that triggers resampling or class-weight adjustment. All models use default class weights.
- cMissing data: Complete-case analysis. 18 observations with any missing covariate value excluded prior to modelling. No imputation performed. Final analytic sample: n = 11,510.
- dT-learner partitioning: Dataset split by observed wealth stratum —
df_rich = df[df.A == 1](n = 6,296) for outcome model μ̂₁;df_poor = df[df.A == 0](n = 5,214) for outcome model μ̂₀.
Rationale for extreme-quintile restriction: Maximises exposure contrast for the counterfactual estimand and reduces positivity violations. Only 52.7% of the full wealth distribution falls within the 0.1–0.9 propensity score overlap range. Findings explicitly do not generalise to the middle three quintiles (~60% of currently married Bangladeshi women).
2
Causal identification & DAG assumptions
Potential outcomes framework (Rubin 1974) · G-computation (Robins 1986) · Estimand: stratum-level counterfactual contrast
Estimand — individual counterfactual OR
Individual counterfactual OR for woman i:
OR_i = [ μ̂₁(Xᵢ) / (1 − μ̂₁(Xᵢ)) ] ÷ [ μ̂₀(Xᵢ) / (1 − μ̂₀(Xᵢ)) ]
where μ̂ₐ(Xᵢ) = P̂(Y = 1 | Xᵢ, A = a) for a ∈ {0 = poorest, 1 = richest}
Interpretation: counterfactual ratio of odds of modern contraceptive use for
woman i under richest vs. poorest wealth quintile assignment, given her
observed covariate profile Xᵢ. This is a stratum-level contrast, not an
individual wealth manipulation.
Three identifying assumptions
- 1Consistency: Yᵢ = Yᵢ(Aᵢ). The observed outcome under assigned wealth group equals the potential outcome under that assignment. Satisfied because wealth-quintile membership is unambiguously defined by the DHS PCA-based wealth index (V190) — no version-of-treatment ambiguity.
- 2Positivity: 0 < P(A = a | X) < 1 for all covariate combinations in the support of X. Empirically verified: all 12 age-group × education strata have n ≥ 30 observations in both wealth groups. PS overlap: 52.7% of sample within range [0.1, 0.9].
- 3Conditional exchangeability: {Y(0), Y(1)} ⊥ A | X given the 8 measured covariates. Unverifiable from data alone. Rests on the DAG in Figure 1. Sensitivity to violations quantified via E-values (see Stage 6).
DAG — covariate roles
Common causes (confounders)
Age, educational attainment, urban/rural residence, household size — included in all models
Mediator treated as confounder
Household size — potential mediator on wealth→contraceptive path; included to close backdoor paths
Unmeasured confounders (dashed nodes)
Partner preferences; geographic method availability — sensitivity quantified via E-values
Positivity verification summary
PS overlap region [0.1, 0.9]
52.7% of sample
Minimum cell size (12 age × education strata)
Total n ≥ 30 per subgroup cell (code checks total n, consistent with §2.11 wording — not split per wealth stratum)
Untrimmed max stabilised IPTW weight
218.56
Untrimmed effective sample size (ESS)
8.7%
3
T-learner model training — six model classes
Two separate outcome models per class: μ̂₁ on richest stratum (n = 6,296) and μ̂₀ on poorest stratum (n = 5,214)
T-learner training structure
- 1Partition analytic sample by observed wealth stratum. No exposure variable A is included as a predictor — each stratum model learns outcome probability conditional on the 8 covariate profile within its wealth stratum only.
- 2Fit each of the 6 model classes independently, producing 12 fitted models in total (2 strata × 6 model classes). Each model predicts P(Y = 1 | X) within its stratum.
- 3Cross-validation for model evaluation only: 5-fold stratified CV is applied on the full pooled analytic sample (not within each stratum separately) using
cross_val_score(clone(model), X, y). This measures each model class's overall discrimination as a pooled predictor. A separate in-sample AUC is also computed on a full-data fit. CV-AUC is not used to select hyperparameters (no nested CV). - 4All continuous covariates standardised using
StandardScaler(fit on full analytic sample, applied to both strata) before model fitting.
Complete hyperparameter specifications — all six model classes
| Model class | Full hyperparameter specification | CV-AUC | Brier score | OR SD |
|---|---|---|---|---|
| Logistic Regression (LR) Parametric benchmark | penalty='l2', C=1.0, solver='lbfgs', max_iter=1000, tol=1e-4, fit_intercept=True, class_weight=None, random_state=42 |
0.6937 | 0.2270 | 0.328 |
| Random Forest (RF) | n_estimators=300, max_depth=6, min_samples_leaf=20, min_samples_split=2, max_features='sqrt', bootstrap=True, n_jobs=-1, random_state=42 |
0.7012 | 0.2264 | 0.171 |
| Gradient Boosting (GB) Selected for subgroup analysis | n_estimators=200, learning_rate=0.05, max_depth=4, subsample=0.8, min_samples_leaf=1, max_features=None, random_state=42. Loss: deviance (log-loss). No early stopping. |
0.7098 | 0.2261 | 1.212 |
| XGBoost (XGB) | n_estimators=200, learning_rate=0.05, max_depth=4, subsample=0.8, colsample_bytree=0.8, reg_alpha=0, reg_lambda=1, eval_metric='logloss', random_state=42 |
0.7085 | 0.2262 | 0.829 |
| LightGBM (LGB) | n_estimators=200, learning_rate=0.05, max_depth=4, num_leaves=31, subsample=0.8, colsample_bytree=0.8, reg_alpha=0, reg_lambda=0, random_state=42. Tree growth: leaf-wise (histogram-based splitting). |
0.7090 | 0.2263 | 0.934 |
| Stacking Ensemble No SHAP · No bootstrap CI | Base learners (reduced specs for computational feasibility): LR (same as primary), RF (n_estimators=200, max_depth=5, min_samples_leaf=20), GB (n_estimators=150, lr=0.05, max_depth=4), XGB (n_estimators=150, lr=0.05, max_depth=4), LGB (n_estimators=150, lr=0.05, max_depth=4). Meta-learner: Logistic Regression (L2, C=1.0). Out-of-fold predictions from 5-fold CV used to train meta-learner. | 0.7108 | 0.2259 | 0.373 |
Class imbalance handling: None applied. Outcome prevalence = 34.9% — above the 10–15% minority-class threshold commonly used to trigger SMOTE, oversampling, or class-weight adjustment.
class_weight=None in all models.Software environment
Python
3.12
scikit-learn
1.6.1
XGBoost
3.2.0
LightGBM
4.6.0
SHAP
Latest stable (TreeExplainer)
Preprocessing
StandardScaler (sklearn)
GB model selection rationale (four criteria)
- iSecond-highest CV-AUC among non-ensemble models (0.7098 vs. Stacking Ensemble 0.7108 — excluded due to absence of native SHAP TreeExplainer support and computational infeasibility of 200-resample PSU-level bootstrap).
- iiWidest individual OR IQR among non-ensemble models (0.670–1.279; SD = 1.212) — superior recovery of OR heterogeneity compared with XGBoost (SD = 0.829) and LightGBM (SD = 0.934).
- iiiSequential residual-fitting architecture makes the probability surface more interpretable for the T-learner structure than the parallel ensemble approaches of LightGBM and XGBoost.
- ivTree structure supports exact (non-approximate) SHAP TreeExplainer attribution via polynomial-time algorithm. Cross-model consistency of subgroup OR pattern across all 6 models confirms GB-based subgroup results are not model-specific artefacts.
Model calibration
- aCalibration assessed via Brier score (mean squared error of predicted probabilities; lower = better) and reliability diagrams (calibration plots) using 10 uniform bins across predicted probability range.
- bAll 6 models show adequate calibration across the 0–0.6 probability range (covers majority of the analytic sample: overall mCP = 34.9%).
- cCalibration caveat for GB: Slight overestimation in the 0.6–0.8 probability range. Since individual ORs are ratios of two T-learner probability surfaces, miscalibration in this range may modestly amplify ORs for high-probability women (older, higher-educated) — representing a conservative direction of bias for the primary finding (OR = 3.557 for 35–49/Higher).
4
G-computation — individual OR estimation
Stratified parametric g-formula (Robins 1986) implemented via T-learner (Künzel et al. 2019, PNAS)
Step-by-step algorithmic procedure
- 1Fit stratum models: For each of the 6 model classes, fit μ̂₁ on
df_richand μ̂₀ ondf_poorusing all 8 standardised covariates. This yields 12 fitted models in total. - 2Generate counterfactual predictions: For every individual i in the full analytic sample (n = 11,510), generate both μ̂₁(Xᵢ) and μ̂₀(Xᵢ) regardless of the individual's observed wealth group. This is the g-computation step — each model extrapolates to both strata.
- 3Clip predicted probabilities: Clip all predictions to [10⁻⁶, 1 − 10⁻⁶] to prevent degenerate (zero or infinite) ORs arising from near-zero or near-unity predicted probabilities in sparse covariate regions.
- 4Compute individual OR: Apply the OR formula (see Stage 2) for each i. This produces a vector of n = 11,510 individual counterfactual ORs per model class.
- 5Trim OR distribution: Trim individual ORs at the 99th percentile of the full-sample distribution for all descriptive statistics and subgroup summaries. Sensitivity confirmed: 95th-percentile trimming yields median subgroup OR shift = 0.000 across all 12 age × education cells.
- 6Summarise distribution: Compute median, IQR (25th–75th percentile), and SD of the individual OR distribution for each model class. Compute absolute risk difference (ARD) as μ̂₁(Xᵢ) − μ̂₀(Xᵢ) for each individual i, then report cell-level median ARD with IQR.
- 7Gini coefficient: Compute Gini coefficient of |log(OR_i)| across the full individual OR vector. Bootstrap 95% CI via 1,000 individual-level resamples.
Gini coefficient of |log ORᵢ|:
Gini = 0.4525
Bootstrap 95% CI (1,000 individual-level resamples): [0.4475, 0.4568]
Interpretation: the top 10% of women (by |log OR|) account for
29.0% of total absolute log-OR mass — high concentration of wealth
effect in a minority of demographic subgroups.
Key subgroup ARDs (GB model):
35–49 / Higher education: median ARD = +17.6 pp (IQR: +11.4 to +23.6 pp)
15–24 / Primary education: median ARD = −11.3 pp (IQR: −16.6 to −5.6 pp)
25–34 / Higher education: median ARD = +13.5 pp (IQR: +4.7 to +18.9 pp)
Relationship to other CATE estimators
| Estimator | Asymptotically valid CIs for individual CATEs? | Binary outcome native? | Role in this study |
|---|---|---|---|
| T-learner g-computation | No — bootstrap CIs for subgroup medians only | Yes (OR estimand) | Primary estimator |
| AIPW (doubly-robust) | Yes (ATE only, not individual) | Yes (risk difference) | Sensitivity check for ATE direction |
| Causal forest (Wager & Athey 2018) | Yes (asymptotically valid) | No — risk difference native | Recommended for future work |
| DR-learner (Kennedy 2023) | Yes (doubly-robust) | Partial | Recommended for future work |
Bootstrap CI scope: PSU-level bootstrap CIs (200 resamples) quantify sampling uncertainty in subgroup median ORs arising from the complex two-stage BDHS cluster design. They are NOT asymptotically valid CIs for individual-level CATE estimates — cross-fitted DR-learner or causal forest estimators would be required for the latter.
5
Subgroup inference & uncertainty quantification
PSU-level stratified bootstrap (200 resamples) · BH-FDR correction · Likelihood-ratio interaction tests
PSU-level bootstrap protocol
- 1Resample primary sampling units (PSUs) with replacement 200 times, preserving the complex two-stage cluster sampling design of the BDHS (Rust & Rao 1996, Stat Methods Med Res).
- 2For each bootstrap resample: (a) refit the GB T-learner pair (μ̂₁ and μ̂₀) on the resampled data; (b) recompute all 11,510 individual ORs; (c) compute subgroup median ORs across the 12 age × education cells and 8 residence × education cells.
- 3Report 2.5th–97.5th percentile of 200 bootstrap subgroup medians as the 95% CI. Bootstrap CIs not computed for Stacking Ensemble due to computational cost (~3–4 hours for GB alone on Intel Core i7, 16 GB RAM).
Survey weight limitation: DHS design weights (sampling weights) were NOT incorporated into ML model fitting — a non-trivial methodological extension requiring careful treatment of PSU-level clustering in the T-learner framework. The PSU-level bootstrap partially accounts for clustered sampling uncertainty. Unweighted ML fitting may bias absolute prevalence estimates but is unlikely to alter the structure of OR heterogeneity, since covariate-specific probability contrasts are relatively robust to moderate survey weight misspecification.
Likelihood-ratio interaction tests — pre-specified primary hypotheses
| Interaction term | LR χ² | df | p-value | Significant (α = 0.05)? | FDR corrected? |
|---|---|---|---|---|---|
| Wealth × Education | 8.348 | 3 | 0.039 | Yes | No — pre-specified primary hypothesis |
| Wealth × Age group | 10.642 | 2 | 0.005 | Yes | No — pre-specified primary hypothesis |
| Wealth × Residence | 2.666 | 1 | 0.103 | No | No — pre-specified primary hypothesis |
Interaction tests compare logistic regression models with and without the specified wealth × modifier interaction terms. These are pre-specified primary hypotheses and are NOT subject to BH-FDR correction (which applies only to the 12 age × education subgroup cell comparisons).
Multiple comparisons correction — BH-FDR
- aBenjamini-Hochberg (BH) FDR correction applied across the 12 age × education subgroup cells to control the expected proportion of false discoveries among rejected hypotheses (Benjamini & Hochberg 1995, JRSS-B).
- bFDR q-values reported alongside raw p-values for all 12 cells. Significance threshold: q < 0.05.
- cMinimum cell reporting threshold: n ≥ 30 observations in both wealth groups within each cell. All 12 age × education strata satisfy this requirement.
Absolute risk difference (ARD) computation
For individual i:
ARD_i = μ̂₁(Xᵢ) − μ̂₀(Xᵢ)
Cell-level summary: median ARD (pp) with IQR across all i in that subgroup cell.
Positive values: richest-quintile women have higher predicted mCP prevalence.
Negative values: poorest-quintile women have higher predicted mCP prevalence.
Note: At observed prevalence levels > 30%, ORs diverge from risk ratios —
programme planners should consult the ARD column for absolute-scale interpretation.
6
Sensitivity & robustness analyses
AIPW doubly-robust ATE · E-value analysis · Three robustness checks
AIPW doubly-robust ATE estimator
AIPW influence function for observation i:
ψᵢ = [ μ̂₁(Xᵢ) + Aᵢ(Yᵢ − μ̂₁(Xᵢ)) / ê(Xᵢ) ]
−[ μ̂₀(Xᵢ) + (1−Aᵢ)(Yᵢ − μ̂₀(Xᵢ)) / (1 − ê(Xᵢ)) ]
ATE_AIPW = n⁻¹ Σᵢ ψᵢ
where ê(Xᵢ) = P̂(A = 1 | Xᵢ) is the propensity score estimated by
logistic regression with all 8 covariates.
Doubly-robust property: consistent if EITHER the outcome model OR
the propensity score model is correctly specified.
PS trimming and covariate balance
- 1Propensity score model: Logistic regression with all 8 standardised covariates estimating ê(Xᵢ) = P̂(A = 1 | Xᵢ).
- 299th-percentile weight trimming (Cole & Hernán 2008): PS clipped to [0.0744, 0.9384]. Trimmed 4,464 observations (38.8% of sample). ESS raised from 8.7% (untrimmed) to 45.4% (5,231 observations). Untrimmed max stabilised IPTW weight = 218.56.
- 3Covariate balance: Standardised mean differences (SMDs) assessed via Love plot before (circles) and after (triangles) IPTW. All post-IPTW SMDs fall within the |<0.1| acceptable balance threshold.
- 4Result: All 6 AIPW ATE estimates are statistically indistinguishable from zero (p = 0.09–0.83). This is the central empirical insight — the aggregate is null because opposing subgroup effects cancel, not because there is no heterogeneity (analogous to Simpson's paradox at the estimand level).
AIPW robustness check — RF propensity score
Specification: RF PS model:
n_estimators=200, max_depth=5, min_samples_leaf=20, random_state=42. All 5 non-RF outcome models yielded near-null AIPW estimates (p = 0.20–0.89) under the RF propensity score, confirming the doubly-robust property. The RF outcome model's significance (p = 0.02) under the RF propensity score reflects RF's propensity to overfit the outcome probability surface, not a genuine nonzero ATE.E-value analysis (VanderWeele & Ding 2017, Ann Intern Med)
E-value formula:
For OR ≥ 1: E = OR + √[ OR × (OR − 1) ]
For OR < 1: First compute 1/OR, then apply above formula.
E-value = minimum OR-scale association an unmeasured confounder
would need to have with BOTH exposure AND outcome simultaneously
to fully explain away the observed association.
Strongest finding — 35–49 / Higher education:
Median OR = 3.557
E-value (point estimate) = 6.572
E-value (IQR lower bound, 25th pct) = 3.551
Classification: Strong (E ≥ 3)
Additional strong findings (E ≥ 3):
15–24 / Primary (OR = 0.552): E-value = 3.024
25–34 / Higher (OR = 2.308): E-value = 4.045
Three robustness checks
| Check | Modification from primary analysis | Result | Conclusion |
|---|---|---|---|
| Alternative trimming threshold | Individual ORs trimmed at 95th percentile instead of primary 99th percentile | Median OR shift = 0.000 across all 12 age × education cells (Supplementary Table S3) | Fully robust — findings not driven by extreme observations |
| Restricted childbearing-age sample | Exclude women aged 45–49; n = 9,847 | Results nearly identical to primary analysis | Elevated OR in older higher-educated women is not an artefact of including post-reproductive-prime women |
| Alternative exposure definition | Wealth dichotomised at median (above vs. below) instead of extreme quintiles; n = 28,519 | Substantial heterogeneity qualitatively preserved; subgroup ORs attenuated relative to extreme-quintile analysis | Expected attenuation from reduced exposure contrast; higher-education urban pattern preserved |
7
SHAP decomposition & programmatic output
Exact SHAP TreeExplainer — predictive attribution only, not causal effects · Programmatic targeting table
SHAP computation protocol
- 1SHAP values computed for the pooled GB model (full-data fit on all n = 11,510 observations — not the stratum-specific T-learner models) using
shap.TreeExplainer. This is the exact polynomial-time algorithm — no approximation (unlike KernelSHAP or sampling approaches). - 2SHAP value ϕⱼ for feature j and observation i = marginal contribution of feature j to μ̂(Xᵢ) relative to the expected model output, averaged over all possible feature orderings (Shapley value from cooperative game theory; Lundberg & Lee 2017, NeurIPS).
- 3Feature importance ranked by mean |ϕⱼ| across all 11,510 observations. Beeswarm plot shows distribution of SHAP values across the full sample (each dot = one woman; horizontal position = direction and magnitude of contribution; colour = feature value: red = high, blue = low).
Critical caveat — SHAP ≠ causal effects: SHAP values decompose variation in the predicted probability of modern contraceptive use. They quantify predictive contributions to the outcome model, NOT causal effects of each covariate on contraceptive use. Furthermore, individual ORs are ratios of two T-learner probability surfaces — SHAP applied to the pooled model cannot be directly translated to the individual OR distribution. The SHAP ranking identifies which covariates most strongly moderate the predicted outcome probability, not which have the largest causal impact.
SHAP feature importance ranking (mean |ϕⱼ|)
| Rank | Feature | DHS variable | Mean |ϕⱼ| | Direction (beeswarm) |
|---|---|---|---|---|
| 1 | Parity (children ever born) | V201 | 0.4113 | Higher parity → lower predicted mCP probability |
| 2 | Currently employed | V714 | 0.3683 | Employed → higher predicted mCP probability |
| 3 | Age in years | V012 | 0.3324 | Older age → higher predicted mCP probability |
| 4 | FP decision autonomy | V632 | 0.2087 | Has say → higher predicted mCP probability |
| 5 | Urban/rural residence | V025 | 0.1424 | Urban → mixed direction by education stratum |
| 6 | Household size | V136 | 0.1191 | Larger household → lower predicted mCP probability |
| 7 | Educational attainment | V106 | 0.0495 | Higher education → higher predicted mCP probability |
| 8 | Media exposure (TV watching) | V158 | 0.0098 | Any TV → slightly higher predicted mCP probability |
Programmatic targeting framework — four-tier classification
High priority — OR ≥ 3.0
35–49 / Higher education (n = 791, OR = 3.557, ARD = +17.6 pp, E-value = 6.57)
Recommended action: subsidised LARC insertion at public urban tertiary facilities; insurance benefit packages covering private-sector long-acting methods; means-tested voucher programmes.
Recommended action: subsidised LARC insertion at public urban tertiary facilities; insurance benefit packages covering private-sector long-acting methods; means-tested voucher programmes.
Moderate priority — OR 1.5–2.9
25–34 / Higher (n = 1,103, OR = 2.308, ARD = +13.5 pp) and 15–24 / Higher (n = 586, OR = 1.544, ARD = +5.7 pp)
Recommended action: targeted demand generation; outreach to urban professional women on public-sector LARC alternatives.
Recommended action: targeted demand generation; outreach to urban professional women on public-sector LARC alternatives.
Low priority — OR 0.8–1.4
35–49 / Secondary (OR = 1.239), 35–49 / Primary (OR = 1.173), 25–34 / No education (OR = 0.883), 15–24 / No education (OR = 0.838)
Recommended action: near-equitable access — monitor trends; maintain existing community supply chain.
Recommended action: near-equitable access — monitor trends; maintain existing community supply chain.
Equity achieved — OR < 0.8
15–24 / Primary (OR = 0.552), 25–34 / Primary (OR = 0.803), 15–24 / Secondary (OR = 0.758), 35–49 / No education (OR = 0.816)
Recommended action: sustain community-based injectable and oral pill distribution programmes — wealth not a barrier in these subgroups.
Recommended action: sustain community-based injectable and oral pill distribution programmes — wealth not a barrier in these subgroups.
Tier threshold caveat: Cutpoints (OR < 0.8; 0.8–1.4; 1.5–2.9; ≥ 3.0) are post-hoc decision-analytic boundaries aligned with natural breaks in the observed OR distribution — not statistically derived thresholds. Programme planners should adapt these to local context, resource constraints, and operational priorities. All findings apply to currently married women in the two extreme wealth quintiles only and should not be extrapolated to the middle three quintiles.