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]
st: Bootstrap results of margins in multiply imputed data
From
"Singer, Adam" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Bootstrap results of margins in multiply imputed data
Date
Wed, 8 Jan 2014 18:30:53 +0000
Dear Statalist,
I am bootstrapping the percent change in x between two years using Stata 12.1. I have written the following program and successfully called it in non-imputed data with the last line of code:
program pctchange, rclass
logit x i.year
margins year
mat A = r(b)
return scalar ratio = A[1,2] / A[1,1]
end
bootstrap r(ratio), reps(200) seed(12345): pctchange
My question pertains to implementing this program in multiply imputed data. I have a multiply imputed dataset in Stata's mi format. In this dataset, the regression must be run using "mi estimate: logit x i.year". However, -margins- does not recognize regression results obtained using -mi estimate-. In order to account for that and other research I've done on user-defined programs in multiply imputed data, I have rewritten the program as follows:
program pctchange, eclass properties(mi)
logit sigpain i.year
margins year, post
mat A = e(b)
ereturn scalar ratio = A[1,2] / A[1,1]
end
bootstrap e(ratio), reps(200) seed(12345): mi estimate, cmdok: pctchange 1
The last command doesn't work. How do I combine -bootstrap- and -mi estimate-? Is there a better way to write the program to accomplish my goal? In addition, if I remove -bootstrap- from the command and simply use "mi estimate, cmdok: pctchange 1" (which works), I notice that e(ratio) is empty (when I ran my first program in non-imputed data, r(ratio) was not empty). Does -mi estimate- interfere with my program's ability to return scalars?
Thank you very much!
Adam Singer
__________________________________________________________________________
This email message is for the sole use of the intended recipient(s) and
may contain confidential information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message.
*
* 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/