
Administrator

On Mon, Jul 19, 2010 at 3:21 PM, Costello, Michael (Contractor)
<mcostello/ [hidden email]> wrote:
> Statalist,
>
> Is it possible to have a command inside a .do file that allows you to call and execute a different .do file, then go back to the original and finish processing?
>
Yes (although a quick experiment of actually trying it out could have
answered this for you ;).
<Start test1.do>
do test2.do
<End test1.do>
<Start test2.do>
di "Hello you've successfully called me from test1.do"
<End test1.do>
do test1
In fact you can do this multiple times and man limits shows you that
you can have upto 64 nested dofiles.
See also [U] 16 DoFiles chapter of the Users Guide for the most
comprehensive overview of writing dofiles
Neil

"... no scientific worker has a fixed level of significance at which
from year to year, and in all circumstances, he rejects hypotheses; he
rather gives his mind to each particular case in the light of his
evidence and his ideas."  Sir Ronald A. Fisher (1956)
Email  [hidden email]
Website  http://slack.ser.man.ac.uk/Photos  http://www.flickr.com/photos/slackline/*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/


In reply to this post by Costello, Michael (Contractor)
 On Mon, 19/7/10, Costello, Michael wrote:
> Is it possible to have a command inside a .do file that
> allows you to call and execute a different .do file, then go
> back to the original and finish processing?
Yes, there are two ways: do will execute the commands in the
.do file and displays the output, while run executes the
commands but suppresses the output. See help do.
Hope this helps,
Maarten

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/


Abdul Salam Lodhi replied to Maarten Buis:
> ya thanks !
> now i am more confident in interprepting my results
Naturally, we're all delighted that you've found a solution to your
problem. However, you can implement the advice given by Maarten and
Scott by using Phil Ender's excellent collin command, downloadable
from SSC. Try it if you're not aware of it!

Clive Nicholas
[Please DO NOT mail me personally here, but at
< [hidden email]>. Please respond to contributions I make in
a list thread here. Thanks!]
"My colleagues in the social sciences talk a great deal about
methodology. I prefer to call it style."  Freeman J. Dyson.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/


When imputing 20 datasets and dong a logistic regression, I still need some descriptive statistics on background/demographic variables to describe the sample.
a. Should I report the demographic means/sd's for each variable using the original dataset and N for each variable?
b. Should I report the grand mean treating the 20 datasets as one big dataset?
c. What is the best practice? Is there a way to get confidence intervals that around the means that take the multiple imputation into account?
Perhaps I'm missing something that is quite obvious.
Alan Acock
*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/


 On Mon, 19/7/10, Alan Acock wrote:
> I still need some descriptive
> statistics on background/demographic variables to describe
> the sample.
> a. Should I report the demographic means/sd's for each
> variable using the original dataset and N for each
> variable?
> b. Should I report the grand mean treating the 20 datasets
> as one big dataset?
> c. What is the best practice? Is there a way to get
> confidence intervals that around the means that take the
> multiple imputation into account?
It can be informative to report both the means in your
original sample and the average of the means in each
imputed sample (the latter is the point estimate in multiple
imputated datasets). If you only want the means and
their standard errors / confidence intervals you can
use the mean command, which can easily be combined
with mim. The example below requires both ice and
mim, which can be downloaded by typing in Stata
ssc install ice and ssc install mim, respectively.
* begin example 
sysuse nlsw88, clear
ice union grade tenure race south, m(5) clear
mean union grade tenure south if _mj == 0
mim: mean union grade tenure south
* end example 
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/



Alan,
One imagines that you do not have much missing data for your demographic variables. I would in general be inclined to give descriptive statistics on nonmissing data only. This avoids any question from readers (and reviewers) about whether the imputation method introduced any biases. The nonmissing data are are, of course, the sample from which imputations are to be made. If you include Ns, then readers can see how much data were imputed.
Dave
====================================
David C. Bell
Professor of Sociology
Indiana University Purdue University Indianapolis (IUPUI)
(317) 2781336
====================================
On Jul 19, 2010, at 5:35 PM, Alan Acock wrote:
> When imputing 20 datasets and dong a logistic regression, I still need some descriptive statistics on background/demographic variables to describe the sample.
> a. Should I report the demographic means/sd's for each variable using the original dataset and N for each variable?
> b. Should I report the grand mean treating the 20 datasets as one big dataset?
> c. What is the best practice? Is there a way to get confidence intervals that around the means that take the multiple imputation into account?
>
> Perhaps I'm missing something that is quite obvious.
>
> Alan Acock
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search> * http://www.stata.com/support/statalist/faq> * http://www.ats.ucla.edu/stat/stata/*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/


Very cool  I had never realized that you can use include
interactively, which executes a .do file in the interactive namespace 
so locals set in the interactive session are visible to it, and those
set in the do file persist after it finishes.
Not sure exactly how this would be useful, but seems like it might be in
some context...
Nick Winter
On 7/19/2010 12:23 PM, Jeph Herrin wrote:


Nicholas Winter 434.924.6994 t
Assistant Professor 434.924.3359 f
Department of Politics [hidden email] e
University of Virginia faculty.virginia.edu/nwinter w
S385 Gibson Hall, South Lawn
*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/


 On Tue, 20/7/10, David Bell wrote:
> One imagines that you do not have much missing data for
> your demographic variables. I would in general be
> inclined to give descriptive statistics on nonmissing data
> only. This avoids any question from readers (and
> reviewers) about whether the imputation method introduced
> any biases. The nonmissing data are are, of course,
> the sample from which imputations are to be made. If
> you include Ns, then readers can see how much data were
> imputed.
The purpose of showing describtive statistics is to give
the reader an idea of what the data is that is being used
in your analysis. Since what you use in your analysis is
the imputed dataset, it would make sense to describe that.
On the other hand the empricial information comes from
your raw/unimputed data.
So I would present both, as it also gives a bit of insight
how the imputation process changes your data. If there are
some big differences then you will need to justify it, but
that is in those extreme cases usually quite easy (e.g.
the missing values are mostely young people who...). This
way you can try to avoid that the reader regards the
imputation as some form of white/black magic.
Hope this helps,
Maarten

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/


Alan,
I assume you mean 20 imputations and not 20 data sets being imputed individually. I also assume that some of the background/demographic variables have missing values and you want to get good estimates of these. So...
Within the mi estimate command, you can use means for these and if you want percentiles, you can use qreg. I have a Stata Tip coming out in vol 10 #3 on this.
Tony
Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 5417373832
FAX: 5417374001
Original Message
From: [hidden email] [mailto: [hidden email]] On Behalf Of Alan Acock
Sent: Monday, July 19, 2010 2:35 PM
To: [hidden email]
Subject: st: summary statistics with mi multiple imputation
When imputing 20 datasets and dong a logistic regression, I still need some descriptive statistics on background/demographic variables to describe the sample.
a. Should I report the demographic means/sd's for each variable using the original dataset and N for each variable?
b. Should I report the grand mean treating the 20 datasets as one big dataset?
c. What is the best practice? Is there a way to get confidence intervals that around the means that take the multiple imputation into account?
Perhaps I'm missing something that is quite obvious.
Alan Acock
*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/*
* For searches and help try:
* http://www.stata.com/help.cgi?search* http://www.stata.com/support/statalist/faq* http://www.ats.ucla.edu/stat/stata/

