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
how to count the numbers of variables that meet some requirements in the matrix?I want to count the numbers of variables whose p value is less than .2 after running a regression mo…
Mean different from zero, problemI want to test if my dependent variable differs significanlty from zero. My sample is not normally d…
Trim Stata OutputHi, My dataset has many (more 100,000) observations. I am running a standard fixed effects model wi…
Dropping lowest n values of a group variableHi, my question is a bit silly but I am just not being very bright today As you can see from the da…
No p-value in xtpedroni cointegration testDear All, I ran xtpedroni cointegration and the p-values are not sowing. However, the reviewer for …
Subscribe to:
Post Comments (Atom)
0 Response to psmatch2 and exact matching
Post a Comment