Code:
Code:
teffects psmatch (mexp) (treat mrq mexporter mimp mhcnt mfor divcode*, logit), nneighbor(5) generate(nn5_)
gen matched = treat == 1
local sampsize = _N
// Nearest Neighbour = 5 Generate when an observation is in the match
quietly forvalues i = 1/`sampsize' {
if treatTailoredEver[`i'] == 1 {
local match1 = nn5_1[`i']
local match2 = nn5_2[`i']
local match3 = nn5_3[`i']
local match4 = nn5_4[`i']
local match5 = nn5_5[`i']
replace matched = 1 in `match1'
replace matched = 1 in `match2'
replace matched = 1 in `match3'
replace matched = 1 in `match4'
replace matched = 1 in `match5'
}
}
Code:
'.' invalid observation number
Yet the underlying issue, which is likely due to my inexperience on teffects, is that I do not know under what situations teffects will fail to find all 5 neighbours on a propensity score matching, but yet itself does not fail due to a failure in the overlap assumption. I would be grateful for any insights anyone has on this.
As an aside, the forvalues loop executes fairly quickly, but if anyone has suggestions on a more elegant solution to the loop, I'm all ears. Thanks!
0 Response to Query on teffects psmatch
Post a Comment