Repository navigation
v0.1.1: pymatchit-causal. Propensity Score Matching (PSM) & Causal Inference in Python
pymatchit-causal is a robust Python port of the standard R package MatchIt. It brings state-of-the-art preprocessing for parametric causal inference to the Python ecosystem, allowing researchers to balance covariates in observational studies effectively and easily create Propensity Score Matching.
🚀 Key Features
- Matching Algorithms: Support for Nearest Neighbor (Greedy), Exact Matching, Subclassification, and Coarsened Exact Matching (CEM).
- Flexible Distance Estimation: Estimate propensity scores using GLM (Logistic Regression), Mahalanobis Distance, or Machine Learning methods (Random Forest, Gradient Boosting, Neural Networks, Lasso/Ridge/ElasticNet) via scikit-learn integration.
- Scientific Validation: Verified against R's
MatchItpackage to ensure statistical consistency and correctness. - Publication-Ready Diagnostics: Generate Love Plots (Standardized Mean Differences), Propensity Score Density Plots, and ECDF Plots using Seaborn.
- Robustness: Includes strict input validation, missing data handling warnings, and "Common Support" discarding logic.
📦 Installation
pip install pymatchit-causal📚 Quick Start
from pymatchit import MatchIt, load_lalonde
# Load standard dataset
df = load_lalonde()
# Perform Nearest Neighbor Matching with Caliper
m = MatchIt(df, method='nearest', distance='glm', caliper=0.2)
m.fit("treat ~ age + educ + race + married + re74 + re75")
# Check Balance
m.plot(type='balance')
# Get Matched Data
matched_data = m.matches()📄 Citation
If you use this software in your research, please cite:
Tünnermann, J. (2025). pymatchit-causal: Propensity Score Matching and Causal Inference in Python (Version 0.1.0) [Computer software]. https://github.com/jtuenner/pymatchit
@software{pymatchit-causal,
author = {Tünnermann, Jonas},
title = {pymatchit: Propensity Score Matching and Causal Inference in Python},
url = {https://github.com/jtuenner/pymatchit},
version = {0.1.0},
year = {2025}
}