Causal Inference with Propensity Scores in Observational Studies
Statistics & ExperimentsModel answerLast updated
Explain propensity score matching, when to use it for causal inference, what assumptions must hold, and how to verify that matching produced comparable groups.
You're working with a product analytics team that frequently needs to draw causal conclusions from observational user data where randomized experiments weren't run.
Answer the following:
-
Explain propensity score matching (PSM). What problem does it solve, and when would you choose this approach for a business analysis?
-
What assumptions must hold for propensity score matching to produce valid causal estimates? Explain each assumption and why it matters.
-
How do you verify that matching worked? Describe the diagnostics you'd run to confirm that treated and control groups are truly comparable after matching.
Your answer should demonstrate understanding of causal identification, not just the mechanics of the matching procedure.
Hints
Hint 1
Consider what makes observational data different from randomized experiments and what confounding means
Hint 2
Think about what happens if treated units have no comparable controls, or if important variables weren't measured
Hint 3
Balance is assessed on the matched sample itself, not through population inference
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer
1. What Propensity Score Matching Is and When to Use It
The core problem: In observational data, groups that receive different treatments differ systematically before treatment. Users who subscribe to a premium service were already more engaged; stores that adopt a new technology were already higher-performing. Comparing outcomes directly conflates the treatment effect with pre-existing differences.
The propensity score e(X) = P(Treatment = 1 | X) is the probability of receiving treatment given observed covariates X. A fundamental result shows that if treatment assignment is ignorable conditional on X, it's also ignorable conditional on the scalar e(X). This reduces high-dimensional covariate matching to matching on a single number.
How it works:
- Select pre-treatment confounders X using domain knowledge and causal reasoning (DAGs help here)
- Fit a model (typically logistic regression) to estimate e(X) for each unit
- Match treated units to control units with similar propensity scores—common approaches include nearest-neighbor matching with or without replacement, often using a caliper (maximum allowable distance, e.g., 0.2 standard deviations of logit propensity)
- Verify balance across all covariates in the matched sample
- Estimate the treatment effect on the matched pairs, typically the ATT (average treatment effect on the treated)
Business use cases:
- Voluntary program adoption: measuring the impact of a loyalty program, premium subscription, or optional feature when users self-select into it
- Marketing campaign evaluation: estimating the effect of promotional emails or ad exposure when no holdout group was maintained
- Operational changes: comparing stores or regions that implemented a process change to similar ones that didn't
- Retrospective analysis: when an A/B test wasn't run due to cost, time, or ethical constraints
The key principle: use PSM when randomization isn't possible and you believe all important confounders are observed.
2. Required Assumptions
Conditional ignorability (unconfoundedness):
Formally: potential outcomes are independent of treatment assignment conditional on X.
In plain terms: after controlling for observed covariates, treatment assignment is as-good-as-random.
This requires that every variable affecting both treatment and outcome is measured and included. If user motivation affects both premium subscription and retention but isn't observed, estimates remain biased. This assumption is fundamentally untestable—you can never prove you observed everything relevant.
Common support (positivity):
Formally: 0 < e(X) < 1 for all covariate patterns.
In plain terms: every treated unit must have plausible control matches, and vice versa.
When treated and control groups occupy different regions of covariate space (e.g., premium subscribers are all high-tenure while free users are all new), comparison is extrapolation, not matching. Units outside the common support region must be excluded, which changes the population your estimate describes.
SUTVA (Stable Unit Treatment Value Assumption):
Two components:
- No interference: one unit's treatment doesn't affect another's outcome. Watch for network effects, household sharing, or marketplace dynamics.
- Treatment consistency: "subscribing to premium" means the same thing for all units; no hidden variation in treatment delivery.
Pre-treatment covariates only:
Include only variables measured before treatment. Post-treatment variables may be affected by treatment (mediators) or open collider paths, both introducing bias. For example, including post-subscription spending in a model predicting premium subscription would be circular.
Adequate propensity model:
The propensity model doesn't need perfect prediction—it needs to balance covariates. Judgment criterion is balance diagnostics, not AUC or log-loss. Very high AUC actually signals poor overlap between groups.
3. Assessing Balance
Balance assessment compares treated and control groups after matching to verify they're comparable on all covariates.
Standardized Mean Difference (SMD):
For each covariate: SMD = (mean_treated - mean_control) / pooled_SD
Calculate this before and after matching. Guideline: |SMD| < 0.1 indicates good balance; some accept up to 0.25. Use the pre-matching pooled standard deviation in the denominator so improvements aren't artifacts of reduced variance.
Variance ratios:
Check var_treated / var_control ≈ 1. Means can match while variances differ substantially, indicating imbalance in the distribution tails.
Distributional balance:
Compare empirical CDFs or use Kolmogorov-Smirnov statistics. Also check balance on transformations: squared terms and key interactions like tenure × region.
Visual diagnostics:
- Love plot: displays SMD for each covariate before/after matching, making improvement immediately visible
- Propensity score overlap: histogram or density plot of e(X) by treatment group. After matching, distributions should closely overlap.
Sample composition:
Report how many treated units were dropped due to caliper restrictions or lack of support. Large exclusions mean your estimate applies to a different, narrower population.
Critical principle: Do not use p-values or hypothesis tests for balance. Balance is a sample property, not a population inference problem. P-values are also sample-size dependent—mechanically dropping observations can "improve" p-values while actual balance worsens.
def standardized_mean_diff(df_matched, df_original, covariates, treatment_col):
"""Calculate SMD using original sample for pooled SD."""
smd = {}
for cov in covariates:
mean_t = df_matched[df_matched[treatment_col]==1][cov].mean()
mean_c = df_matched[df_matched[treatment_col]==0][cov].mean()
var_t = df_original[df_original[treatment_col]==1][cov].var()
var_c = df_original[df_original[treatment_col]==0][cov].var()
pooled_sd = np.sqrt((var_t + var_c) / 2)
smd[cov] = (mean_t - mean_c) / pooled_sd if pooled_sd > 0 else 0
return smd
Key Limitations and Trade-offs
Unobserved confounding: The fatal weakness. If an unmeasured variable drives both treatment and outcome, PSM cannot remove that bias. Sensitivity analyses (Rosenbaum bounds, E-values) quantify how severe hidden confounding would need to be to overturn conclusions.
Information loss: Discarding unmatched units reduces sample size and may introduce bias if missingness is systematic.
Inference challenges: Standard errors must account for propensity score estimation uncertainty and potential reuse of controls. Naive methods underestimate uncertainty.
Alternatives worth considering:
- Inverse propensity weighting (retains all data)
- Doubly robust estimators (robust to misspecification of either propensity or outcome model)
- Difference-in-differences (when pre-treatment outcomes are available)
- Regression adjustment on matched samples (removes residual imbalance)
When PSM shines: Clear selection on observables, good covariate overlap, stable treatment definition, and no interference. When these don't hold, be explicit about limitations and consider alternatives.