I've had to implement these formulas myself to combine results from
likelihoods I've had to program, so the following Stata code should work
(double checking of formulas is always a good idea).
Note that this is currently hard coded for five imputations.
Put the following program at the top of you batch file:
#delimit;
program define midisp;
local names: colnames(Q1);
matrix Q = (Q1 + Q2 + Q3 + Q4 + Q5)/5; /* MI param estimates */
matrix W = (W1 + W2 + W3 + W4 + W5)/5; /* MI covariances */
local k = colsof(Q);
forvalues i=1/5 {;
matrix QQ=Q`i'-Q;
if `i'==1 {;
matrix B=(QQ)'*QQ;
};
else matrix B = B + (QQ)'*QQ;
};
matrix B=B/(5-1); /* Covariance adjustment */
matrix V=W+(1+1/5)*B; /* Final covariance */
ereturn post Q V;
ereturn display;
end;
Then run your models on the imputed data sets. Here I have them stacked on
top of each other in one dataset with a variable, imputeid, indicating
each of the five imputed data sets.
forvalues id=1/5 {;
quietly regress y x1 x2 if imputeid == `id'; /* Your model here */
matrix Q`id' = e(b);
matrix W`id' = e(V);
};
midisp;
On Mon, 6 Apr 2009, Ken Scheve wrote:
> Date: Mon, 6 Apr 2009 14:46:57 -0400
> From: Ken Scheve <[log in to unmask]>
> Reply-To: Political Methodology Society <[log in to unmask]>
> To: [log in to unmask]
> Subject: Re: [POLMETH] A question on using Stata on imputed data files
>
> I would note that my little "miest" routine was written for Stata 7.0 when
> you used to be able to indicate the cross-sectional and time variables
> directly in the command line for commands like xtpcse (without xtset). It
> worked fine then but does need to be updated now that this seems to be no
> longer possible. One way to handle the problem is by directly programming the
> multiple imputation estimates of the coefficients and standard errors in
> Stata which can be done for any command. The equations for combining
> estimates are on p. 53 of our paper:
> http://pantheon.yale.edu/~ks298/index_files/Missing2001.pdf
>
> Ken
>
> Paul Warwick wrote:
>> I recently tried to do a time series cross-section analysis using Stata's
>> xtpcse routine on a set of Amelia-imputed data files. The information on
>> the MI program in Stata indicates that it supports xtpcse, but using xtpcse
>> requires that one have previously defined the country and time variables
>> with xtset (or tsset), and I can't find any way of doing this for the
>> imputed data files. Ken Scheve, MI's author, suggested that I edit lines 8
>> and 9 of the miest.ado file, substituting my country variable name for
>> "panelvar" and my time variable name for "timevar", but this doesn't seem
>> to work, either. Has anyone figured out a work-around for this problem?
>> It is likely to affect not just xtpcse but all the xt routines in Stata.
>>
>>
>>
>> Prof. Paul V. Warwick,
>> School for International Studies and Dept. of Political Science,
>> Simon Fraser University.
>> **********************************************************
>> Political Methodology E-Mail List
>> Editors: Melanie Goodrich, <[log in to unmask]>
>> Xun Pang, <[log in to unmask]>
>> **********************************************************
>> Send messages to [log in to unmask]
>> To join the list, cancel your subscription, or modify
>> your subscription settings visit:
>>
>> http://polmeth.wustl.edu/polmeth.php
>>
>> **********************************************************
>
> **********************************************************
> Political Methodology E-Mail List
> Editors: Melanie Goodrich, <[log in to unmask]>
> Xun Pang, <[log in to unmask]>
> **********************************************************
> Send messages to [log in to unmask]
> To join the list, cancel your subscription, or modify
> your subscription settings visit:
>
> http://polmeth.wustl.edu/polmeth.php
>
> **********************************************************
>
- Fred
< ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Frederick J. Boehmke
< Associate Professor of Political Science
> University of Iowa
<
> 308 Schaeffer
< 319-335-2342
> http://www.fredboehmke.net
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**********************************************************
Political Methodology E-Mail List
Editors: Melanie Goodrich, <[log in to unmask]>
Xun Pang, <[log in to unmask]>
**********************************************************
Send messages to [log in to unmask]
To join the list, cancel your subscription, or modify
your subscription settings visit:
http://polmeth.wustl.edu/polmeth.php
**********************************************************
|