Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Random slope model in xtmixed


From   David Hoaglin <dchoaglin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Random slope model in xtmixed
Date   Wed, 4 Apr 2012 11:52:38 -0400

Dear Nicola,

No one else has answered yet, so let me ask a question.

In the -xtmixed- command that uses y2009 as a predictor, the
fixed-effects part of the model seems to contain a variable
(ib1.HIVprevG_UNGASS) that is not present in the -xtmixed- command
that uses y2007.  The output, however, does not show a coefficient for
that variable.  What results do you get when you remove it from the
fixed-effects part of the model?  (If I'm missing something obvious, I
apologize.)

David Hoaglin

On Wed, Apr 4, 2012 at 12:09 AM, Nicola Man <n.man@unsw.edu.au> wrote:
> Hi,
>
> I have a question about fitting random slopes in mixed models that I can't make sense of.  The random slope variable is year which ranges from 2004 to 2009.  As an illustrative example, I fitted two models which are exactly the same except:
>
> Model 1) year, y2009, is recalculated so that 2009 gets a value of 0 to 2004 which gets a value of -5 (i.e. y2009=2009-Year)
>
> Model 2) year, y2007, is recalculated so that 2009 gets a value of 2 to 2004 which gets a value of -3 (i.e. y2007=2007-Year)
>
> Below is the abbreviated output:
> . xtmixed lgt_P_ART4_nm2 y2009 ib1.HIVprevG_UNGASS || CtryN: y2009 , var nolog
>
> Mixed-effects ML regression                     Number of obs      =       683
> Group variable: CtryN                           Number of groups   =       128
>
>                                                Obs per group: min =         1
>                                                               avg =       5.3
>                                                               max =         6
>
>                                                Wald chi2(1)       =    269.38
> Log likelihood = -920.36467                     Prob > chi2        =    0.0000
>
> --------------------------------------------------------------------------------
> lgt_P_ART4_nm2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> ---------------+----------------------------------------------------------------
>         y2009 |   .4921368   .0299851    16.41   0.000     .4333672    .5509065
>         _cons |   .4236186   .1367187     3.10 0.002     .1556548    .6915824
> --------------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
>  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
> -----------------------------+------------------------------------------------
> CtryN: Independent           |
>                  var(y2009) |   .0856863   .0143532      .0617061    .1189858
>                  var(_cons) |   2.165006   .3010598      1.648517    2.843314
> -----------------------------+------------------------------------------------
>               var(Residual) |   .3364985   .0234767      .2934923    .3858065
> ------------------------------------------------------------------------------
> LR test vs. linear regression:       chi2(2) =   670.34   Prob > chi2 = 0.0000
>
> . xtmixed lgt_P_ART4_nm2 y2007 || CtryN: y2007 , var nolog
>
> Mixed-effects ML regression                     Number of obs      =       683
> Group variable: CtryN                           Number of groups   =       128
>
>                                                Obs per group: min =         1
>                                                               avg =       5.3
>                                                               max =         6
>
>
>                                                Wald chi2(1)       =    247.17
> Log likelihood = -914.25608                     Prob > chi2        =    0.0000
>
> --------------------------------------------------------------------------------
> lgt_P_ART4_nm2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> ---------------+----------------------------------------------------------------
>         y2007 |   .4993922   .0317645    15.72   0.000     .4371349    .5616495
>         _cons |  -.5720239   .1271442    -4.50   0.000    -.8212219   -.3228259
> --------------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
>  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
> -----------------------------+------------------------------------------------
> CtryN: Independent           |
>                  var(y2007) |    .099806   .0169902      .0714916    .1393344
>                  var(_cons) |   1.960566   .2713017      1.494834    2.571403
> -----------------------------+------------------------------------------------
>               var(Residual) |   .3294286   .0225424       .288081    .3767106
> ------------------------------------------------------------------------------
> LR test vs. linear regression:       chi2(2) =   682.56   Prob > chi2 = 0.0000
>
> I get completely different estimates including that for the LL for the model as a whole. Does anyone have an idea as to why that might be the case?

*
*   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   |   Site index