Bookmark and Share

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: Multiple imputation combined with collapse


From   Steven Samuels <[email protected]>
To   [email protected]
Subject   Re: st: Multiple imputation combined with collapse
Date   Tue, 2 Aug 2011 20:08:05 -0400

--

Chris, the passive variables have nothing to do with it. -mi xeq collapse- shows the same behavior without them.  Here's your example, modified.

*****************
clear*
set obs 1000
set seed 1

gen y = runiform()
gen x = runiform()
gen groupvar = int(runiform()*10)
gen b = runiform()
replace x = . if b < .15
drop b

mi set wide
mi register imputed x

mi impute regress x y, add(4)
mi xeq: collapse y x _*, by(groupvar)
*******************

On Jul 30, 2011, at 1:07 PM, Chris Parker wrote:

Hi Statalist,

I have a question about multiple imputation. I have missing data in one
of my variables, x in the example below, which I then create several
passive variables for. I then collapse the data and try to run a
regression but the collapsed passive variables based on x are identical
to the collapsed original x variable. Does anyone know what I am doing
wrong here? I tried searching in [MI] but found no reference to
-collapse- which I take as a sign that I cannot do what I am trying to
do. Is -mi- unable to handle collapse?

Like some others on the list I am still (unfortunately) using Stata
11.2. My current machine OS is PC though I have tested this on a Unix
machine with the same results. I have not tested on a Mac as of yet.

Chris

***** Simulation Example *****

clear*
set obs 1000
set seed 1

gen y = runiform()
gen x = runiform()
gen groupvar = int(runiform()*10)
gen b = runiform()
replace x = . if b < .15
drop b

mi set wide
mi register imputed x
mi impute regress x y, add(10)

sort groupvar

mi passive: by groupvar: egen sumx = total(x)
mi passive: gen xshare = x/sumx
mi passive: gen xshare_sq = xshare^2
mi passive: by groupvar: egen hhi = total(xshare_sq)

mi xeq: collapse y x hhi _mi_*, by(groupvar)

mi estimate: regress y x hhi



______________________________________________________________________

This email has been scanned by the MessageLabs Email Security System
on behalf of the London Business School community.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index