Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: -mi- & Factor Variables


From   ymarchenko@stata.com (Yulia Marchenko, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -mi- & Factor Variables
Date   Wed, 12 Aug 2009 12:04:15 -0500

Alan Taylor <Alan.Taylor@psy.mq.edu.au> reported what seems to be a potential
bug in -mi test- when it is used with factor variables:

> I ran this analysis on an imported imputed dataset in Stata:
>
> . mi estimate, cmdok: ///
>    xtmixed IEStot Group##MQvsComgrps##PTSS_2Grps##time || subject:, variance
>
> I then wanted to test whether the four-way interaction was significant, and
> tried
>
> . mi test Group#MQvsComgrps#PTSS_2Grps#time
> Group#MQvsComgrps#PTSS_2Grps#time not found
> r(111);

The above is intended behavior rather than a bug.  Similar to the -test-
command, the -mi test- command does not allow the above specification for
simultaneous testing of all interaction levels.  You must list interaction
level indicators directly as Alan demonstrated below:

> I found, however, that the full specification of the test did work OK with
> -mi- :
>
> . mi test 2.Group#2.MQvsComgrps#1.PTSS_2Grps#2.time ///
>   2.Group#2.MQvsComgrps#1.PTSS_2Grps#3.time ///
>   2.Group#2.MQvsComgrps#1.PTSS_2Grps#4.time 
> note: assuming equal fractions of missing information
>
> ( 1)  [IEStot]2.Group#2.MQvsComgrps#1.PTSS_2Grps#2.time = 0
> ( 2)  [IEStot]2.Group#2.MQvsComgrps#1.PTSS_2Grps#3.time = 0
> ( 3)  [IEStot]2.Group#2.MQvsComgrps#1.PTSS_2Grps#4.time = 0
>
>       F(  3,23565.0) =    0.33
>            Prob > F =    0.8035
>

More generally, -mi test- as well as -test- do not accept the <varlist>
specification of which Alan's specification of
Group#MQvsComgrps#PTSS_2Grps#time is a particular case.  Instead, these
commands require the <coeflist> specification.  

The <coeflist> specification described in detail in -help test- is more
restrictive than the <varlist> specification (see -help varlist-).  For
example, it does not allow certain shorthand conventions such as myvar*,
my~var, etc. which are allowed with variable names.  The <coeflist>
specification includes the names as stored in matrix column names of the saved
coefficient matrix, -e(b)-.  

As of Stata 11, you can use the -coeflegend- option with most Stata estimation
commands and -mi estimate-, in particular, to display the coefficient names
along with other information.  The -coeflegend- option can be specified on
replay if you need to look up these names after fitting the original model.

For example, Alan can type

   . mi estimate, coeflegend

to see coefficient names.  See -help estimation options- to read more about
the -coeflegend- option.

Note that the -testparm- command does allow the <varlist> specification.  We
will consider adding -mi testparm- in the future allowing the <varlist>
specification.


--Yulia
ymarchenko@stata.com
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index