Dear all,
while using Coarsened Exact Matching (CEM), one of the striking things I noticed was that the algorithm does not offer an option which allows the user to ask for an exact match on some variables (unlike other matching algorithms such as matching estimators). Suppose we are talking about companies and one variable tells the nationality of firms - with nationality being not the treatment variable - and assume one wants matched pools made of only firms coming from the same country as the treated observation, the algorithm seems to offer no options to do that.
For this reason, I devised a solution using a loop. I am showing that on the forum because I am not completely sure this is the cleverest way to do that and, secondly, because I'd like to hear whether someone thinks there are good reasons not to implement that.
Many thanks!
Riccardo
while using Coarsened Exact Matching (CEM), one of the striking things I noticed was that the algorithm does not offer an option which allows the user to ask for an exact match on some variables (unlike other matching algorithms such as matching estimators). Suppose we are talking about companies and one variable tells the nationality of firms - with nationality being not the treatment variable - and assume one wants matched pools made of only firms coming from the same country as the treated observation, the algorithm seems to offer no options to do that.
For this reason, I devised a solution using a loop. I am showing that on the forum because I am not completely sure this is the cleverest way to do that and, secondly, because I'd like to hear whether someone thinks there are good reasons not to implement that.
Code:
tempfile `"`results'"' save `"`results'"', emptyok local nation italy spain france us colombia foreach country of local nation{ use file.dta if nation==`country' capture noisily cem var1 var2 var3, treatment(treat) /// I am doing this because sometimes the subset of file.dta is too small for cem to work if _rc==0{ append using `"`results'"' save `"`results'"', replace } clear }
Many thanks!
Riccardo
Comment