miaohancheng / pysmatch

Propensity Score Matching(PSM) on python
MIT License
103 stars 22 forks source link

Bipartite matching? #2

Closed griffincorriher closed 3 weeks ago

griffincorriher commented 3 weeks ago

Is it possible to do bipartite matching, or sampling without replacement? I know this handles multiple matches using weights, but is it possible to have a 1:1 match only? Would setting method='min' and nmatches=1 be comparable? Thanks! https://www.statisticshowto.com/propensity-score-matching/#:~:text=Bipartite%20designs%20are%20more%20common%2C

miaohancheng commented 3 weeks ago

Currently, there are no strict restrictions in the code for sampling without replacement. Setting method='min' and nmatches=1 can approximate sampling without replacement. I will try to add code that strictly enforces sampling without replacement during the matching process.

miaohancheng commented 3 weeks ago

@griffincorriher The new version has been released, and you can try it out by using pip install pysmatch==0.5. The match method now includes a new parameter replacement to determine whether replacement is necessary during matching. Here is an example of how to use it in Python code:

m.match(method="min", nmatches=1, threshold=0.0001, replacement=False)

If you encounter any issues after trying it, please contact me promptly. Thank you for your suggestions.

griffincorriher commented 3 weeks ago

Awesome! I am starting the project next week and hope to test it out. I appreciate the quick response and implementation!