// Barbara Sianesi // Stata Users' Group Meeting -- London, September 10, 2010 // PSMATCH2 EXAMPLE use nsw_psid, clear desc more ta treated more // Propensity score /************************************************************************/ more dprobit treated age black hispanic married educ nodegree re75 more cap drop score predict double score more // Common support /************************************************************************/ more summarize score if treated==1, detail more summarize score if treated==0, detail more density2 score, group(treated) more psgraph, treated(treated) pscore(score) bin(50) more // Nearest neighbour without replacement without caliper /************************************************************************/ more psmatch2 treated, pscore(score) outcome(re78) noreplacement more pstest2 age black hispanic married educ nodegree re75, sum graph more // Nearest neighbour without replacement within caliper /************************************************************************/ more psmatch2 treated, pscore(score) outcome(re78) noreplacement caliper(0.01) more summarize _support if treated==1 display 1-r(mean) more psgraph more pstest2 age black hispanic married educ nodegree re75, sum graph more // Nearest neighbour with replacement /************************************************************************/ more psmatch2 treated, pscore(score) outcome(re78) more summarize _pdif, detail more psmatch2 treated, pscore(score) outcome(re78) caliper(0.01) more summarize _support if treated==1 display 1-r(mean) more tab _weight if treated==0 more psgraph more density2 score, g(treated) more density2 score, g(treated) m(_weight) more pstest2 age black hispanic married educ nodegree re75, sum graph more density2 re75 if re75<40000, g(treated) more density2 re75 if re75<40000, g(treated) m(_weight) more // >1-to-1 matching /************************************************************************/ more psmatch2 treated, pscore(score) outcome(re78) neigh(10) more psmatch2 treated, pscore(score) outcome(re78) neigh(20) more psmatch2 treated, pscore(score) outcome(re78) neigh(10) cal(0.01) more tab _nn if treated==1 more psmatch2 treated, pscore(score) outcome(re78) neigh(20) cal(0.01) more tab _nn if treated==1 more // Kernel matching /************************************************************************/ more psmatch2 treated, pscore(score) outcome(re78) kernel k(epan) bw(0.06) more psmatch2 treated, pscore(score) outcome(re78) kernel k(normal) bw(0.06) more psmatch2 treated, pscore(score) outcome(re78) kernel k(epan) bw(0.01) more psmatch2 treated, pscore(score) outcome(re78) kernel k(normal) bw(0.01) more // Mahalanobis-metric matching /************************************************************************/ more psmatch2 treated, mahal(age black hispanic married educ nodegree re75) outcome(re78) more pstest2 age black hispanic married educ nodegree re75, sum graph more psmatch2 treated, mahal(score age black hispanic married educ nodegree re75) outcome(re78) more pstest2 age black hispanic married educ nodegree re75, sum graph more // ATNT /************************************************************************/ more gen treat0 = 1-treated more psmatch2 treat0 age black hispanic married educ nodegree re75, outcome(re78) * Remember to take -1*(effect) for ATNT. more sum _pdif, d more psmatch2 treat0 age black hispanic married educ nodegree re75, outcome(re78) cal(0.01) more tab _weight if treat0==0 more pstest2 age black hispanic married educ nodegree re75, sum graph more psmatch2 treated age black hispanic married educ nodegree re75, outcome(re78) kernel ate more film re78 treated age black hispanic married educ nodegree re75, ate more qui regress re78 treated##c.age treated##black treated##hispanic treated##married treated##c.educ treated##nodegree treated##c.re75 more margins, dydx(treated) more margins, dydx(treated) over(treated) more