Creating quintiles after MI impute

863 views
Skip to first unread message

Cathal McCrory

unread,
Mar 13, 2014, 7:33:15 AM3/13/14
to missin...@googlegroups.com
Dear Jonathan,
I imputed for cases missing on income (continuous) using the MI impute command in STATA 12.0. 
I tried to create income quintiles from the imputed data using the following: mi passive: xtile newinc = income, n(5) but MI passive isn't working.
Can you suggest a way to do this?

Cathal

Jonathan Bartlett

unread,
Mar 13, 2014, 7:55:44 AM3/13/14
to missin...@googlegroups.com
Hi Cathal

If you impute using the long form in Stata, my first idea was to manually (i.e. without using the mi passive command) generate the quntiles using xtile in each imputed dataset, using something like:

bysort _mi_m: xtile newinc = income, n(5)

but this doesn't work because the xtile command cannot be used with bysort. A more long-winded solution would be to use a for loop, cycling through the imputations (I'm assuming there are 10 imputations):
gen newinc=.
forvalues i=1(1)10 {
    xtile temp = income if _mi_m==`i', n(5)
    replace newinc=temp if _mi_m==`i'
    drop temp
}

But shortly after asking the question, Cathal emailed me which a much neater solution, to use the egen=cut() command, which can be used with mi passive:

mi passive: egen newinc = cut(hhinc), group(5)

More generally, the advantage of using mi passive rather than manually manipulating the variables (as I was trying to do), is that mi passive correctly takes the appropriate steps regardless of how you have mi set the data, whereas my attempts at solutions would only work with the data imputed in the long form.

Best wishes
Jonathan

Cathal McCrory

unread,
Mar 26, 2014, 10:47:53 AM3/26/14
to missin...@googlegroups.com
Hi Jonathan,
Do you know of a way to derive survey weighted income quintiles after applying the MI algorithm. 

I have ran into problems.
1. The xtile command does not work with MI passive (see previous post)
2. My workaround solution mi passive: egen income = cut(hhinc), group(5) does not work with survey weights.

I had toyed with defining the cut-points after imputing using xtile newinc = hhinc [pweight = weight], n(5) but i'm not sure this is recommended. The Stata manual recommends using mi passive. Thanks.

Cathal

Jonathan Bartlett

unread,
Apr 14, 2014, 3:51:55 AM4/14/14
to missin...@googlegroups.com
Hi Cathal

As far as I am aware, Stata recommend using mi passive because by doing that Stata can ensure that passive variables are updated correctly (e.g. whether you use long or wide storage formats).

I would do as you suggest, and define the cut-points, using the weights, separately by imputation in a for loop:

gen newinc=.
forvalues i=1(1)10 {
    xtile temp = income [pweight=weight] if _mi_m==`i', n(5)
    replace newinc=temp if _mi_m==`i'
    drop temp
}
Reply all
Reply to author
Forward
0 new messages