Propensity Score Matching Python-based code
Description
This repository offers a free, Python-based code for performing propensity score (PS) matching. Designed for clinicians and researchers, this tool simplifies PS matching and provides comprehensive visualizations to assess matching quality. The code implements (i) Logistic regression to calculate PS, (ii) 1:N matching using the K-nearest neighbor (KNN) algorithm with a customizable caliper, (iii) sampling without replacement to ensure robust matching, and (iv) visualizations for assessing matching quality. Outputs: Matched pairs saved as a .csv file (and identified as Coxreg requires) as well as diagnostic plots saved in the specified output folder. Under the MIT License, this code was developed with assistance and refinement provided by OpenAI's ChatGPT.
Notes
Files
Propensity_Score_Distribution_Density.png
Files
(238.3 kB)
Name | Size | Download all |
---|---|---|
md5:a97623c0c51fd2e04ad4601265315055
|
67.7 kB | Preview Download |
md5:171767103c436cd40833594400ee91be
|
43.9 kB | Preview Download |
md5:43861955b4e2feb619bf6ac5b1afb34c
|
10.0 kB | Download |
md5:554b44747e0693d5914dad93230e9ee0
|
56.8 kB | Preview Download |
md5:38318e80c2af94bbc654a2c1362385e2
|
59.8 kB | Preview Download |
Additional details
Software
- Repository URL
- https://github.com/epsar-co/Propensity-Score-Matching-Python-based-code.git
- Programming language
- Python
References
- Staffa SJ, Zurakowski D. Five Steps to Successfully Implement and Evaluate Propensity Score Matching in Clinical Research Studies. Anesth Analg. 2018;127:1066-1073. doi: 10.1213/ANE.0000000000002787.
- Thoemmes, F. Propensity score matching in SPSS. 2012. Available at: https://arxiv.org/pdf/1201.6385.
- Stuart EA. Matching methods for causal inference: A review and a look forward. Stat Sci. 2010;25:1-21. doi: 10.1214/09-STS313.
- Brookhart MA, Schneeweiss S, Rothman KJ, Glynn RJ, Avorn J, Stürmer T. Variable selection for propensity score models. Am J Epidemiol. 2006;163:1149-56. doi: 10.1093/aje/kwj149