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: More mixed confusion


From   Scott Baldwin <[email protected]>
To   [email protected]
Subject   Re: st: More mixed confusion
Date   Wed, 10 Jul 2013 13:33:18 -0600

Suppressing the constant in the random effects will ensure that a
random intercept for the given id variable isn't estimated. The
--nocons-- option is useful in a number of scenarios. For example,
using the 'childweight' data from the manuals, you can fit the
following model:

webuse childweight
mixed weight age || id:

which provides the variance for the random intercept (person specific
deflections in weight)

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Identity                 |
                  var(_cons) |   .6076662   .2040674      .3146395    1.173591
-----------------------------+------------------------------------------------
               var(Residual) |   1.524052   .1866496      1.198819    1.937518
------------------------------------------------------------------------------

This dataset includes boys and girls.

tabulate girl

     gender |      Freq.     Percent        Cum.
------------+-----------------------------------
        boy |        100       50.51       50.51
       girl |         98       49.49      100.00
------------+-----------------------------------
      Total |        198      100.00

we may want to estimate a unique random intercept for boys and one for
girls because we think the person specific deflections in weight are
different for boys and girls. To do this you need to create a boy
dummy variable to go with the girl dummy variable (I don't think you
can use standard factor variables in --mixed--).

gen boy=girl==0

tabulate girl, nolabel
tabulate boy, nolabel


The model is specified as:

mixed weight age || id: boy girl, nocons

which gives you separate random intercepts variances by boy and girl.

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Independent              |
                    var(boy) |   .7620931   .3329286      .3237065    1.794174
                   var(girl) |   .4330075   .2723947        .12619    1.485819
-----------------------------+------------------------------------------------
               var(Residual) |   1.530808   .1887532      1.202168     1.94929
------------------------------------------------------------------------------

You need to suppress the overall intercept in the random effects
portion or you can't estimate this model (the dummy variables will be
collinear with the overall intercept). Indeed, try

mixed weight age || id: boy girl

you will see that Stata will automatically drop one of the variables.

Best,
Scott


On Wed, Jul 10, 2013 at 1:15 PM, Scott Baldwin <[email protected]> wrote:
> Sorry about that -- I sent my email before I was done. Starting over...
>
> Suppressing the constant in the random effects will ensure that a random
> intercept for the given id variable isn't estimated. The --nocons-- option
> is useful in a number of scenarios. For example, using the 'childweight'
> data from the manuals, you can fit the following model:
>
> webuse childweight
> mixed weight age || id:
>
> which provides the variance for the random intercept (person specific
> deflections in weight)
>
> ------------------------------------------------------------------------------
>   Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf.
> Interval]
> -----------------------------+------------------------------------------------
> id: Identity                 |
>                   var(_cons) |   .6076662   .2040674      .3146395
> 1.173591
> -----------------------------+------------------------------------------------
>                var(Residual) |   1.524052   .1866496      1.198819
> 1.937518
> ------------------------------------------------------------------------------
>
> This dataset includes boys and girls.
>
> tabulate girl
>
>      gender |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>         boy |        100       50.51       50.51
>        girl |         98       49.49      100.00
> ------------+-----------------------------------
>       Total |        198      100.00
>
> we may want to estimate a unique random intercept for boys and one for girls
> because we think the person specific deflections in weight are different for
> boys and girls. To do this you need to create a boy dummy variable to go
> with the girl dummy variable (I don't think you can use standard factor
> variables in --mixed--).
>
> gen boy=girl==0
>
> tabulate girl, nolabel
> tabulate boy, nolabel
>
>
> The model is specified as:
>
> mixed weight age || id: boy girl, nocons
>
> which gives you separate random intercepts variances by boy and girl.
>
> ------------------------------------------------------------------------------
>   Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf.
> Interval]
> -----------------------------+------------------------------------------------
> id: Independent              |
>                     var(boy) |   .7620931   .3329286      .3237065
> 1.794174
>                    var(girl) |   .4330075   .2723947        .12619
> 1.485819
> -----------------------------+------------------------------------------------
>                var(Residual) |   1.530808   .1887532      1.202168
> 1.94929
> ------------------------------------------------------------------------------
>
> You need to suppress the overall intercept in the random effects portion or
> you can't estimate this model (the dummy variables will be collinear with
> the overall intercept). Indeed, try
>
> mixed weight age || id: boy girl
>
> you will see that Stata will automatically drop one of the variables.
>
> Hope that helps and sorry for the two emails.
>
> Best,
> Scott
>
>
>
> On Wed, Jul 10, 2013 at 11:12 AM, Lucas <[email protected]> wrote:
>>
>> A (seemingly) simple question: What does it mean in stata to suppress
>> the constant from "the" random effects equation?
>>
>> (Note: Although I use the terms here, I agree with Andrew Gelman's
>> very clear critical observations on the terms "fixed effect" and
>> "random effect", which can be found by googling "Why I don't use the
>> term "fixed and random effects"").
>>
>> The reason I ask is that the output does not seem to provide an
>> equation for the "random effect".  We do see a variance, and if there
>> are multiple random effects, we see variances and covariances.  Thus,
>> where is the constant (if we do not use the noconstant option)?  What
>> is the constant giving us?  What does using the noconstant take away
>> from the output?  Is the constant some parameter for the variance?  If
>> so, where does it appear in the greek-equation specification of the
>> model?  (And, just for clarity-sake, why aren't the other parameters
>> involved in the variance (e.g., the context-level Z's) in the random
>> effects area as opposed to being forced up into the fixed effects area
>> by interactions?)
>>
>> Things become a bit less clear if multiple parameters are allowed to
>> vary across contexts (e.g., the slope for Education and the slope for
>> Occupation vary across contexts).  It seems one is allowed to specify
>> noconstant for one, both, or none of the "random effects."  But,
>> 1)how, and, 2)what would it mean, as the random effect section of the
>> output doesn't seem to contain constants whether one uses the
>> noconstant option or not?
>>
>> I've been using the software, nut, as my work becomes more complex, I
>> am pushed to consider many options I had not needed before.  And, upon
>> closer inspection, I realize I am confused as to the basic
>> "noconstant" option for the "re" equation, and now this de-stabilizes
>> my sense of what the "re" section of the output is doing (or
>> suppressing). Although I did not read every example, I have looked
>> over some of the -me- examples in the stata13 manual and so far have
>> not found any cases where the noconstant option is used in the random
>> effects equation.  Perhaps I missed it, and, if so, I'd appreciate
>> being pointed to the example(s) that might clarify matters.  At any
>> rate, these are emerging questions.
>>
>> Thanks a bunch.
>> Sam
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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