Hello all!
I am trying to combine the psmatch2 command with exact matching. More specifically, I am trying to adapt the code given in "help psmatch2" so as to only get a pscore for each observation (I estimate the ATT later taking a differences-in-differences approach).
Below is the code provided in Stata:
Matching within strata
The following code illustrates how to match within exact cells and then calculate the average effect for the whole population.
g att = .
egen g = group(groupvars)
levels g, local(gr)
qui foreach j of local gr {
psmatch2 treatvar varlist if g==`j', out(outvar)
replace att = r(att) if g==`j'
}
sum att
and below is what I immediately thought of doing:
global psmlist x y z
probit treatvar $psmlist
predict double p, pr
g p2=p
egen g=group(groupvars)
levels g, local (gr)
qui foreach j of local gr {
psmatch2 treatvar $psmlist if g==`j', pscore(p2) caliper (0.01) norepl common
replace p2 = r(p2) if g==`j'
}
which yields the exact same result as for the predicted p variable (which doesn't include exact matching). I also do not get any of the usual variables that comes with psmatch2 (i.e. _id, _n1 etc)
Clearly I don't fully understand the original code. Can someone help me out, please?
PS: I have already estimated p2 using the code detailed here: https://www.stata.com/statalist/arch.../msg00073.html , but my supervisor recommended that I try to modify the officially given code instead.
Many thanks!
Melanie
Related Posts with psmatch2 and exact matching
Grouping Countries According To Level of GDP per capitaHello, I am very new to Stata and excuse me in advance if this is somewhat of an easy question to ta…
Removing a list of string from mailing addressHi all, I have a database of mailing address that I need to do some cleaning on it. Some of the add…
Help with hurdle modelHello - i'm having some trouble running a churdle model. I have observational data (4,800 observati…
Dummy for event in prior ten yearsThis is my first post, I hope I express myself and my question in an understandable manner. I have …
Truncate the continuous variable (0,1)Dear Stata Expert, May I seek your help in variable transformation? I need to truncate the variable…
Subscribe to:
Post Comments (Atom)
0 Response to psmatch2 and exact matching
Post a Comment