Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:  st: Covariate balance test with teffects nnmatch/psmatch in Stata
From 
 
"Sebastian Beil (dienstlich)" <[email protected]> 
To 
 
"Stata List" <[email protected]> 
Subject 
 
Re:  st: Covariate balance test with teffects nnmatch/psmatch in Stata 
Date 
 
14 Aug 2013 15:48:20 +0200 
Hello Lena,
to my knowledge (and unfortunately) there is no such option available 
for the official teffects commands. I explain one way to generate 
matched samples (in the case of the of 1-to-1 NN-matching for the ATT).
After having randomly sorted the dataset, you generate a variable 
containing the row number of the person:
gen rownum = _n
Within the matching command you specify the generate-option that 
generates a new variable containing the row number of the matched 
controls/treated [here: gen(nnid)]:
teffects nnmatch (depvar indepvars) (treat),  atet  gen(nnid)
Stata generates nnid# were # stands for the number of matched controls 
(#>1 in the case of ties or 1-to-m NN-matching). Save the dataset and 
then keep only those treated observations that have no missing 
information for the nnid1 variable and save your treated file:
save complete.dta, replace
keep if treat == 1 & !mi(nnid1)
save treated.dta, replace
You can check whether there are controls that are matched to more than 
one treated observation with duplicates report nnid1. Open your complete 
dataset, keep only the controls, drop the nnid1 variable and rename the 
variable containing the row number in nnid1. Merge this control-file 
(master) using the treated file (using). The key variable is nnid1.
[...]
merge 1:m nnid1 using treated.dta, keepusing(nnid1)
keep if _merge == 3
The 1:m option has to be specified if you match with replacement because 
you might have one control obs. matched to multiple treated obs. 
Afterwards you just have to append the treated file. You now have a 
matched sample and can run tests or run pstest using the raw option. 
Control observations used multiple times are more than once in your 
dataset and therefore weighted appropriately.
I hope this helps,
Sebastian
----------------------------------------------------------------------------------------
From       "Zwick, Lina" <[email protected]>
To       "[email protected]" <[email protected]>
Subject       st: Covariate balance test with teffects nnmatch/psmatch 
in Stata 13
Date       Mon, 12 Aug 2013 07:31:17 +0000
Dear Statalist user,
I did covariate matching and ps matching (ATE and ATT) using the new 
command "teffects nnmatch" respectively "teffects psmatch" in Stata 13. 
Now I would like to check whether the matched covariates are balanced 
but cannot find any option or a similar command like "pstest" when using 
the "psmatch2". Is there any command for the balance check? And if I 
apply alternatively a t-test how can I save the matched sample?
Thanks a lot for your help!
Lina
----------------------------------------------------------------------------------------
--
Sebastian Beil, M.A.
Wissenschaftlicher Mitarbeiter
Lehrstuhl für empirische Sozialforschung
Ruhr-Universität Bochum
Fakultät für Sozialwissenschaft
Universitätsstr. 150
D-44780 Bochum
Raum: GB 1/32
Tel.: +49 (0)234 32 - 27791
e-mail: [email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/