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
Idiosyncratic Volatility - Rolling WindowHello everyone! I am trying to compute idiosyncratic volatility on a rolling basis of 24 months wit…
New to STATA | Linear regression on STATAHi, I am new to STATA and I am trying to do a linear regression analysis for a college project. I …
Mean if respondents have answerd atleast out of 3 variablesHi I would reaaly be grateful if anyone can help with providing a code for this. I have 3 sets of v…
cross classified multilevel structureDear Stata Forum, I am using mixed estimating a cross-classified multilevel model with three levels…
GMM estimation inside a do loop with foreachDear Friends, I am trying to use GMM to estimate a model that is nonlinear in its parameters. The …
Subscribe to:
Post Comments (Atom)
0 Response to psmatch2 and exact matching
Post a Comment