Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: gllamm versus xtmelogit?

 From Jessi Bishop-royse To statalist@hsphsun2.harvard.edu Subject st: gllamm versus xtmelogit? Date Sat, 26 Jun 2010 20:47:24 -0700 (PDT)

```Good evening
Stata-listers.  I posted a question
earlier this week about the difference between gllamm and xtmelogit.  It was suggested that I post with some actual
runs… so here it goes.
I am examining the relationship between infant death and race (black) and county
characteristics.  In this particular
case, I am using “living in a county whose black population makes up more than
20% of the total population” (perblack_1980).  When I run this in a regular logit model, I get this:

. logit
infdeath black perblack_2000
Logistic
regression                               Number of obs   =     196866
LR chi2(2)      =     203.71
Prob > chi2     =     0.0000
Log
likelihood = -7463.3413                       Pseudo R2       =     0.0135

------------------------------------------------------------------------------
infdeath |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
black |   .8629113   .0588078    14.67   0.000     .7476501    .9781725
perblack_2~0
|  -.0803407   .0585524    -1.37   0.170    -.1951013    .0344198
_cons |  -5.289602   .0466641  -113.35   0.000    -5.381062   -5.198142
------------------------------------------------------------------------------

This seems
reasonable to me- that this particular indicator (perblack_2000) would not be
strongly associated with the outcome variable (infdeath).  But, given that perblack_2000 is a county
level variable and I am trying to model individual level outcomes, maybe I
ought to use a multilevel model.  So, I
give gllamm a try (note: “countynumber” indicates the various counties in my
state (66)).

. gllamm
infdeath black perblack_1980, i(countynumber) iter(20)
number of level
1 units = 115830
number of level
2 units = 66

Condition
Number = 977.95272

gllamm model

log likelihood
= 90582.914

------------------------------------------------------------------------------
infdeath |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
black |    .008246   .0007593    10.86   0.000     .0067577    .0097343
perblack_1~0
|   .0816055   .1932153     0.42   0.673    -.2970895    .4603005
_cons |  -.0305581   .0966077    -0.32   0.752    -.2199056    .1587894
------------------------------------------------------------------------------

Variance at
level 1
------------------------------------------------------------------------------

.01223974 (.00005086)

Variances and
covariances of random effects
------------------------------------------------------------------------------

***level 2
(countynumber)

var(1): .0058739 (.02746937)
------------------------------------------------------------------------------

So using
gllamm, I see that the racial differences in the outcome virtually disappear
(goes from .86 to .008) – but are still significant.  While I would be overjoyed at the prospect of
this being a legitimate finding, I have reservations about these results.  First, the county level predictor is not significant.  But it reduces the racial difference in the
outcome variable (infdeath) to virtually nothing?  This runs counter to the entire field.  So clearly, I can’t believe this.  So I ran extmelogit to see what I would get
including this particular county level variable in the mix.

. xtmelogit
infdeath black || countynumber: perblack_1980
Mixed-effects
logistic regression               Number
of obs      =    115830
Group variable:
countynumber                    Number of
groups   =        66

Obs per group: min =        57
avg
=    1755.0
max =     20303

Integration
points =   7                        Wald chi2(1)       =    111.18
Log likelihood
= -7678.5034                     Prob
> chi2        =    0.0000

------------------------------------------------------------------------------
infdeath |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
black |   .5878518   .0557511    10.54   0.000     .4785816    .6971221
_cons |  -4.581075   .0489012   -93.68   0.000    -4.676919    -4.48523
------------------------------------------------------------------------------

------------------------------------------------------------------------------
Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
countynumber:
Independent    |
sd(pe~_1980) |   .2097735   .1263758        .06441    .6832003
sd(_cons) |   .1465535   .0546145      .0705973    .3042314
------------------------------------------------------------------------------
LR test vs.
logistic regression:     chi2(2) =     8.79   Prob > chi2 = 0.0123

Note: LR test
is conservative and provided only for reference.

This seems
reasonable… Not only is the racial difference a little smaller (and still
significant), but the county level indicator is almost significant.

So my question
is: what are the legitimate results here?  Which model should I stick with?  Gllamm or xtmelogit?  What are the
benefits to sticking with one versus the other? Does anyone have any thoughts?

Thanks so much

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