📊 PropensityScore - Propensity Score Matching Analysis

PSM for causal inference | MatchIt | Covariate Balance | Treatment Effect Estimation

1. Data Input

2. Variable Selection

3. Matching Options


Downloads







How to Use Propensity Score Matching

What is Propensity Score Matching?

Propensity Score Matching (PSM) is a statistical technique used to estimate the causal effect of a treatment by matching treated and control subjects with similar propensity scores. The propensity score is the probability of receiving treatment given observed covariates.

Workflow
  • Step 1: Load data and select variables: treatment (binary 0/1), outcome, and covariates.
  • Step 2: Set matching options: method, ratio, caliper, replacement.
  • Step 3: Run analysis and check the Propensity Scores distribution.
  • Step 4: Review matching results and assess covariate balance (SMD < 0.1 is ideal).
  • Step 5: Estimate the treatment effect on the matched sample.
Variable Requirements
  • Treatment: Binary variable (0 = control, 1 = treated).
  • Outcome: Continuous or binary. Used for treatment effect estimation. Do NOT include the outcome variable in the propensity score model — this would introduce collider bias and invalidate causal inference.
  • Covariates: Variables that may confound the treatment-outcome relationship. Select all relevant confounders measured before treatment assignment.
  • ID columns are automatically excluded from covariate selection.
Matching Methods
  • Nearest Neighbor: Greedy matching. Each treated unit is matched to the nearest control. Fast and widely used.
  • Optimal Matching: Minimizes the total distance across all pairs. Uses optimal assignment algorithm.
  • Full Matching: Creates subclasses containing both treated and control units. Maximizes sample usage.
Key Parameters
  • Caliper: Maximum acceptable distance for matching. Default 0.2 x SD of logit(PS). Smaller caliper = stricter matching but fewer matches.
  • Ratio: Number of controls matched per treated unit. 1:1 is most common.
  • Replacement: Whether a control can be matched to multiple treated units. Increases match quality but complicates variance estimation.
Balance Assessment
  • SMD (Standardized Mean Difference): Measures the difference between groups in units of standard deviation.
  • SMD < 0.1: Well balanced. Covariate distribution is similar between groups.
  • SMD 0.1 - 0.25: Moderate imbalance. Consider adjusting matching parameters.
  • SMD > 0.25: Large imbalance. Matching may be inadequate.
  • The green dashed line in the SMD plot marks the 0.1 threshold.
Treatment Effect
  • Continuous Outcome: Weighted mean difference with 95% CI and p-value. Wilcoxon rank-sum test as non-parametric alternative.
  • Binary Outcome: Risk difference with chi-square or Fisher's exact test.
  • Note: Effect estimates use matching weights. For rigorous inference, consider using the survey package or bootstrapping.
Demo Data

Simulated treatment study (n=400) with treatment confounded by age, sex, BMI, and smoking status. Treatment has a true effect of +3 on the continuous outcome and log-odds +1.2 on the binary outcome.

Reference

Ho DE, Imai K, King G, Stuart EA. MatchIt: Nonparametric Preprocessing for Parametric Causal Inference. Journal of Statistical Software. 2011;42(8):1-28.


Response to Reviewers

Q1. Does the PS model wrongly include the outcome variable?

No. The PS model only includes baseline covariates (treatment ~ age + sex + ...), as per Rubin (1997). The outcome is used only after matching for effect estimation, never in the PS model.

Q2. How is the caliper set? Is it a multiple of the SD of logit PS?

Caliper = caliper x SD(logit PS), default 0.2 SD, following Austin (2011). This is implemented in MatchIt(distance="glm", caliper=...) in logit units.

Q3. Is the SMD for categorical variables reasonable?

For categorical variables, the app reports the maximum proportion difference (max |p1 - p0|), not the continuous SMD formula, with the 0.1 balance threshold based on VanderWeele & Ding (2017).

Q4. Does matching account for pairing/weighting structure?

Yes. MatchIt matching weights are used via survey::svyglm for effect estimation, with SEs adjusted by the survey design. For 1:1 matching without replacement, a paired t-test is additionally provided.

Q5. Is sample loss after matching reported?

Yes. The Balance Table header shows matched sample sizes (e.g., Treated: 100 -> 80, Control: 200 -> 80), and unmatched subjects are excluded with a notification.

Q6. Does the weighted variance estimator underestimate?

No. The denominator uses the Kish factor n_eff = (sum w)^2 / sum(w^2), rather than naive sum(w)=1, avoiding underestimation in small samples.

Q7. Is balance tested?

Yes. Standardized difference tables and Love plots are provided; all covariates with SMD < 0.1 are considered adequately balanced.

Q8. Sensitivity analysis?

Users can switch caliper, matching ratio, and replacement in the UI, and download matched data for external regression sensitivity checks.

Q9. Software / versions?

R >= 4.0, MatchIt >= 4.0, survey, shiny. The code is open-source and reproducible.

Q10. How to extend to competing-risk / survival outcomes?

Matched weight data can be directly fed into Fine-Gray or Cox models (see the CompetingRisk component in this project). This module reports mean/ratio effects only.

九方思乐 · math81.com · 粤ICP备2026092768号