Skip to content

Propensity Score matching - #2288

Open
jburroni wants to merge 26 commits into
statsmodels:mainfrom
jburroni:psmatch
Open

jburroni wants to merge 26 commits into
statsmodels:mainfrom
jburroni:psmatch

Conversation

@jburroni

Copy link
Copy Markdown

This is a Work In Progress of the Propensity Score matching algorithm: #858

@josef-pkt

Copy link
Copy Markdown
Member

Thanks @jburroni that's very helpful.
I will have a look later to remind myself what's in here.
Did you have or did we have an example script?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

circular reference of instances, slows down garbage collection

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling?

@kshedden

Copy link
Copy Markdown
Contributor

It's a good start, I'm happy to see this.

I think a high priority would be to get a test script going with at least a few basic tests is it.

@josef-pkt

Copy link
Copy Markdown
Member

@kshedden Thanks for reviewing.
AFAIK, The reference for this is the user package psmatch2 for Stata.
http://www.ssc.wisc.edu/sscc/pubs/stata_psmatch.htm recommends now to use Stata's teffects
(I only have Stata 12 and not 13), the main difference seems to be that the standard errors take the matching into account.

@jburroni

Copy link
Copy Markdown
Author

I've used Dehejia and Wahba 2002 (*) to understand the method and their
dataset to help the development

() Dehejia, Rajeev H, and Sadek Wahba. “Propensity Score-Matching Methods
for Nonexperimental Causal Studies.” *Review of Economics and Statistics

84, no. 1 (2002): 151–61.

On Sun, Feb 22, 2015 at 12:29 PM, Josef Perktold [email protected]
wrote:

@kshedden https://github.com/kshedden Thanks for reviewing.
AFAIK, The reference for this is the user package psmatch2 for Stata.
http://www.ssc.wisc.edu/sscc/pubs/stata_psmatch.htm recommends now to use
Stata's teffects
(I only have Stata 12 and not 13), the main difference seems to be that
the standard errors take the matching into account.

—
Reply to this email directly or view it on GitHub
#2288 (comment)
.

" To be is to do " ( Socrates )
" To be or not to be " ( Shakespeare )
" To do is to be " ( Sartre )
" Do be do be do " ( Sinatra )

@jburroni

Copy link
Copy Markdown
Author

I found two extra notebooks where I've replicated Gagliani et al. 2009 (*)
using pscore. Some comments are in Spanish, though.

http://nbviewer.ipython.org/gist/jburroni/56ee3af1faf216a88bf9
http://nbviewer.ipython.org/gist/jburroni/5141c7dd404fa2257870

Galiani, Sebastian, MARTIN GONZALEZ-ROZADA, and Ernesto Schargrodsky.
“Water Expansions in Shantytowns: Health and Savings.” Economica 76, no.
304 (2009): 607–22.

On Sun, Feb 22, 2015 at 12:47 PM, Javier Burroni [email protected]
wrote:

I've used Dehejia and Wahba 2002 (*) to understand the method and their
dataset to help the development

() Dehejia, Rajeev H, and Sadek Wahba. “Propensity Score-Matching Methods
for Nonexperimental Causal Studies.” *Review of Economics and Statistics

84, no. 1 (2002): 151–61.

On Sun, Feb 22, 2015 at 12:29 PM, Josef Perktold <[email protected]

wrote:

@kshedden https://github.com/kshedden Thanks for reviewing.
AFAIK, The reference for this is the user package psmatch2 for Stata.
http://www.ssc.wisc.edu/sscc/pubs/stata_psmatch.htm recommends now to
use Stata's teffects
(I only have Stata 12 and not 13), the main difference seems to be that
the standard errors take the matching into account.

—
Reply to this email directly or view it on GitHub
#2288 (comment)
.

" To be is to do " ( Socrates )
" To be or not to be " ( Shakespeare )
" To do is to be " ( Sartre )
" Do be do be do " ( Sinatra )

" To be is to do " ( Socrates )
" To be or not to be " ( Shakespeare )
" To do is to be " ( Sartre )
" Do be do be do " ( Sinatra )

@jankatins

Copy link
Copy Markdown
Contributor

I would like to use this. What is missing until this can be merged?

@josef-pkt

Copy link
Copy Markdown
Member

@kshedden added some review comments that need to be addressed.
Main missing "feature" are unit tests.

(In the long run we have to think about the structure so we can mix and match different matching algorithms with different statistical analysis based on the matched data. That's more for the wishlist than a requirement for this PR.)

@jankatins

Copy link
Copy Markdown
Contributor

@josef-pkt Unittests = get some data, run it in R, translate the results to unittests which compare the output from R to the output from statsmodels?

@jankatins

Copy link
Copy Markdown
Contributor

@josef-pkt

Copy link
Copy Markdown
Member

about unit tests: Yes, that's how we verify our numbers, either get the results out of R or Stata, (In some cases we compare against published numbers, when we don't find corresponding R or Stata commands.)

I haven't really looked at the details yet. From the general description, matchit is more general in that it matches observations into groups that can be used for stratified regression, or estimate with any model. AFAIK, Here we have so far mainly the based matched (paired) t-test.
That is, if the matching part is separated from the pure treatement outcome part, then the matching can be reused for any type of statistical analysis. (Based on what I remember from partial reading of the matchit description and articles.)

My usual offer: If someone is working on this, then I try to catch up or keep up with some of the readings (especially details of Stata implementation) to help out.
(My own work will be to finish up inverse probability weighting for treatment effects estimation.)

@josef-pkt

Copy link
Copy Markdown
Member

http://econometricsense.blogspot.de/2015/03/using-r-matchit-package-for-propensity.html
is also just using a paired t-test, so we should be able to replicate.

AFAIR @jburroni used initially a Stata user package psmatch. Stata 13 introduced ps matching, but they use Abadie Imbens corrected standard error.

@VincentLa14

Copy link
Copy Markdown

Has there been any progress on implementing PSM in statsmodels?

@josef-pkt

josef-pkt commented Nov 17, 2017 •

Copy link
Copy Markdown
Member

@VincentLa14 No, nothing new on matching in statsmodels (except for the similar approach in imputation, MICE)
There is some work outside of statsmodels, e.g.
https://github.com/kellieotto/pscore_match
I listed the ones that were available around 1.5 years ago in #2871

My own target was more IPW and similar approaches #2455 (which is closer to the theory that I'm familiar with because of the smoothness)

@lincolnfrias

Copy link
Copy Markdown

To help those working on this: a very rigorous implementation of propensity score matching in python is
https://github.com/laurencium/causalinference/

It follows closely the main reference in this area:

Imbens, Guido W., and Donald B. Rubin. Causal inference in statistics, social, and biomedical sciences. Cambridge University Press, 2015.

@jseabold jseabold removed this from the 0.8 milestone Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants