# st: Problem with xtmixed

 From "Noori Akhtar-Danesh" To Subject st: Problem with xtmixed Date Wed, 4 Jun 2008 11:30:39 -0400

Dear list members,
I am trying to familiarize myself with multilevel modeling technique with stata. So, I am following the commands and methods described in Rabe-Hesketh & Skrondal (Multilevel and longitudinal modeling using stata). The problem is that when I use the following three commands the outputs from xtreg and gllamm are quite similar but output from xtmixed is totally different! Am I missing something here? Your help is appreciated (I am using the smoking.dta dataset).
Noori

The commands and outputs are given below:

. xtreg birwt male smoke mage married hsgrad somecoll collgrad black kessner2 kessner3 novis

```it pretri2 pretri3, i( momid) mle
```
Fitting constant-only model:
...
Iteration 2: log likelihood = -65145.752
Random-effects ML regression Number of obs = 8604
Group variable: momid Number of groups = 3978
Random effects u_i ~ Gaussian Obs per group: min = 2
avg = 2.2
max = 3
LR chi2(13) = 659.47
Log likelihood = -65145.752 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
birwt | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | 120.9375 9.558721 12.65 0.000 102.2027 139.6722
smoke | -218.3289 18.20988 -11.99 0.000 -254.0196 -182.6382
mage | 8.100548 1.347266 6.01 0.000 5.459956 10.74114
married | 49.9202 25.50319 1.96 0.050 -.0651368 99.90554
hsgrad | 56.84715 25.03538 2.27 0.023 7.778705 105.9156
somecoll | 80.68607 27.30914 2.95 0.003 27.16115 134.211
collgrad | 90.83273 27.99598 3.24 0.001 35.96162 145.7038
black | -211.4138 28.27818 -7.48 0.000 -266.838 -155.9896
kessner2 | -92.91883 19.92624 -4.66 0.000 -131.9736 -53.86411
kessner3 | -150.8759 40.83414 -3.69 0.000 -230.9093 -70.84246
novisit | -30.03035 65.69213 -0.46 0.648 -158.7846 98.72387
pretri2 | 92.8579 23.19258 4.00 0.000 47.40127 138.3145
pretri3 | 178.7295 51.64145 3.46 0.001 77.51416 279.9449
_cons | 3117.191 40.97597 76.07 0.000 3036.88 3197.503
-------------+----------------------------------------------------------------
/sigma_u | 338.7674 6.296444 326.6487 351.3358
/sigma_e | 370.6654 3.867707 363.1618 378.324
rho | .4551282 .0119411 .4318152 .4785967
------------------------------------------------------------------------------
Likelihood-ratio test of sigma_u=0: chibar2(01)= 1108.77 Prob>=chibar2 = 0.000

. xtmixed birwt male smoke mage married hsgrad somecoll collgrad black kessner2 kessner3 nov

```isit pretri2 pretri3 || momid, mle
```
Performing EM optimization:
Iteration 0: log likelihood = -65700.231
numerical derivatives are approximate
flat or discontinuous region encountered
numerical derivatives are approximate
flat or discontinuous region encountered
Hessian has become unstable or asymmetric
Mixed-effects ML regression Number of obs = 8604
Group variable: _all Number of groups = 1
Obs per group: min = 8604
avg = 8604.0
max = 8604

Wald chi2(13) = 911.67
Log likelihood = -65700.231 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
birwt | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | 116.5254 10.81218 10.78 0.000 95.33388 137.7168
smoke | -257.6816 16.96037 -15.19 0.000 -290.9233 -224.4399
mage | 6.34559 1.162535 5.46 0.000 4.067064 8.624117
married | 47.55764 20.85405 2.28 0.023 6.68446 88.43082
hsgrad | 51.71874 20.32376 2.54 0.011 11.8849 91.55257
somecoll | 78.70874 22.28125 3.53 0.000 35.03829 122.3792
collgrad | 92.73394 23.03199 4.03 0.000 47.59208 137.8758
black | -217.1142 22.81888 -9.51 0.000 -261.8384 -172.3901
kessner2 | -94.28808 21.88354 -4.31 0.000 -137.179 -51.39713
kessner3 | -176.7858 45.20995 -3.91 0.000 -265.3956 -88.17591
novisit | -29.39211 72.34855 -0.41 0.685 -171.1927 112.4084
pretri2 | 105.0418 25.65007 4.10 0.000 54.76855 155.315
pretri3 | 212.1842 57.22074 3.71 0.000 100.0336 324.3348
_cons | 3177.767 35.38331 89.81 0.000 3108.417 3247.117
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Independent |
sd(momid) | .0000906 . . .
sd(_cons) | 1.571395 . . .
-----------------------------+------------------------------------------------
sd(Residual) | 501.2193 . . .
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(2) = 0.00 Prob > chi2 = 1.0000
Note: LR test is conservative and provided only for reference.
Warning: convergence not achieved; estimates are based on iterated EM

. gllamm birwt male smoke mage married hsgrad somecoll collgrad black kessner2 kessner3 novi

```sit pretri2 pretri3, i( momid) adapt
```
...

number of level 1 units = 8604
number of level 2 units = 3978

Condition Number = 8059.0646

gllamm model

log likelihood = -65145.752

------------------------------------------------------------------------------
birwt | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
male | 120.9375 9.558726 12.65 0.000 102.2027 139.6722
smoke | -218.3289 18.20989 -11.99 0.000 -254.0197 -182.6382
mage | 8.100549 1.347267 6.01 0.000 5.459954 10.74114
married | 49.9202 25.50322 1.96 0.050 -.0651816 99.90559
hsgrad | 56.84715 25.03541 2.27 0.023 7.77866 105.9156
somecoll | 80.68607 27.30916 2.95 0.003 27.1611 134.211
collgrad | 90.83273 27.99601 3.24 0.001 35.96157 145.7039
black | -211.4138 28.27821 -7.48 0.000 -266.8381 -155.9895
kessner2 | -92.91883 19.92625 -4.66 0.000 -131.9736 -53.86409
kessner3 | -150.8759 40.83416 -3.69 0.000 -230.9094 -70.84241
novisit | -30.03035 65.69217 -0.46 0.648 -158.7846 98.72394
pretri2 | 92.8579 23.1926 4.00 0.000 47.40125 138.3145
pretri3 | 178.7295 51.64148 3.46 0.001 77.5141 279.945
_cons | 3117.191 40.976 76.07 0.000 3036.88 3197.503
------------------------------------------------------------------------------

Variance at level 1
------------------------------------------------------------------------------
137392.81 (2867.2533)

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

***level 2 (momid)

var(1): 114763.41 (4266.0686)
------------------------------------------------------------------------------

============================
Noori Akhtar-Danesh, PhD
Faculty of Health Sciences,
McMaster University,
1200 Main St. West, Room 3N28B
Tel: 905-525-9140 Ext. 22297 & 22725
Fax: 905-521-8834
http://www.fhs.mcmaster.ca/ceb/faculty_member_akhtar-danesh.htm
=============================
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/