Research indexObservational
epsar-co/Propensity_score_matching_Python-based_code: Propensity_Score_Matching_Python_v2.0
epsar-co
Zenodo (CERN European Organization for Nuclear Research)15 Mar 2025Open access
NobleIDark:/48914/w1/20260525/CEDFA40CDOI10.5281/zenodo.14635119
epsar-co/Propensity_score_matching_Python-based_code: Propensity_Score_Matching_Python_v2.0
epsar-co · Zenodo (CERN European Organization for Nuclear Research) · 2025
NobleIDark:/48914/w1/20260525/CEDFA40CDOI10.5281/zenodo.14635119
Free to read at the publisher
You can read the abstract here, or the full text at the publisher.
Abstract
OVERVIEW Four variants of a free, Python-based code for performing propensity score (PS) matching have been developed. An initiative of the Camargo Cohort Study (Cantabria, Spain), developed with the aim of sharing the tool and spreading the use of PS matching. No funding was received for conducting this work and there are no financial or non-financial interests to disclose. Assessment of the matching process / Validation The matching quality can be rated by using the following recommended statistics: Standardized mean difference: After matching, between -0.1 and 0.1 Variance ratio: Ater matching, close to 1 McFadden's pseudo-R²: After matching, close to 0 L1 multivariate imbalance: L1 is a measure of multivariate imbalance bounded by 0 (perfect balance) and 1 (complete separation in the cross-tabulation). It is desirable for L1 to be smaller in the matched sample than in the unmatched sample. The four tests examine all the covariates used to estimate the PS as well as the variables defined by the user as additional covariates. When running these statistics, sampling without replacement, ratio 1:1 and caliper=0.20 are applied by default. The results are provided as a diagnostic plot (SMD), as separate files or gathered in a Balance Report (code 3). Comparison between Python-based code and PSM performed by SPSS (based on R packages) The code was tested by comparing the results with those of a PSM in SPSS based on R packages (Propensity Score Matching for SPSS v1.0, by Thoemmes F). We selected certain characteristics (5 covariates selected to estimate the PS, caliper=0.20, ratio 1/1, sampling without replacement), and applied them on the same dataset with both methods. We observed significant discrepancies in the PS values and in the composition of the matched sample. The differences were probably due to several factors -PS estimation, optimisation algorithms, caliper application...- reflecting the different performances offered by Python libraries (matplotlib, sklearn) and R-based packages (MatchIt, RItools, cem). However, as shown in the file, the SMD were identical by using both methods. It validates our approach and shows that the Python implementation is reliable.