# st: likelihood ratio test in gllamm

 From "Jinseok Kim" <[email protected]> To <[email protected]> Subject st: likelihood ratio test in gllamm Date Wed, 03 Jan 2007 12:43:01 -0500

```dear statalisters:

I am conducting a meta analysis using gllamm. I try to test level-2
variance of studies in my data set using "lrtest" command after running
two models with and without level-2 random varinace component but could
not do it. Here's the code and log file. (This question continues after
the log.)

generate lns = ln(selogor^2)/2

. gen con=1

. eq het: lns

. eq con: con

.
. constraint define 1 [lns1]lns=1

. constraint define 2 con=0

.
. ***  test the significance of variance component **********
. gllamm logor, i(id) constraints(1 2) s(het) nip(20) eqs(con) adapt

Iteration 0:    log likelihood = -18.883616
Iteration 1:    log likelihood = -18.507467
Iteration 2:    log likelihood = -18.507467

Iteration 0:   log likelihood = -18.507467
Iteration 1:   log likelihood = -18.507467

number of level 1 units = 15
number of level 2 units = 15

Condition Number = 1

gllamm model with constraints:
( 1)  [lns1]lns = 1
( 2)  [id1_1]con = 0

log likelihood = -18.50746697625409

------------------------------------------------------------------------------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
_cons |   .8756758   .0597778    14.65   0.000     .7585135
.9928381
------------------------------------------------------------------------------

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

7.3890561 (0)

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

***level 2 (id)

var(1): 0 (0)
------------------------------------------------------------------------------

. gllamm logor, i(id) constraints(1) s(het) eqs(con) nip(20) adapt

Iteration 0:    log likelihood = -17.842539
Iteration 1:    log likelihood = -17.412761
Iteration 2:    log likelihood = -17.408093
Iteration 3:    log likelihood = -17.408083

Iteration 0:   log likelihood = -17.408083
Iteration 1:   log likelihood = -17.408082
Iteration 2:   log likelihood = -17.408082

number of level 1 units = 15
number of level 2 units = 15

Condition Number = 2.0297247

gllamm model with constraints:
( 1)  [lns1]lns = 1

log likelihood = -17.40808155481952

------------------------------------------------------------------------------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
_cons |   .9949935   .1653354     6.02   0.000     .6709422
1.319045
------------------------------------------------------------------------------

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

7.3890561 (0)

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

***level 2 (id)

var(1): .1219127 (.16087598)
------------------------------------------------------------------------------

. lrtest
In the old syntax, the unrestricted model defaulted to a model saved
under the name 0.
r(198);

I took the first model as a model without random intercept and the
second with random intercept and tried to test the level 2 variance
component. The last error message is what I've got when I typed
"lrtest". So I typed "estimate table" command to see what're saved but
there is no "log likelihood" value in the table. Maybe that's why but I
don't know why I don't see the value from the estimate table. Following
is all I've got when I typed "estimate table" command.

. est t

---------------------------
Variable |   active
-------------+-------------
logor        |
_cons |  .99499354
-------------+-------------
lns1         |
lns |          1
-------------+-------------
id1_1        |
con |  .34915999
---------------------------

.

I understand that I can "manually" conduct chi square test using log
likelihood values from each model but wonder why I don't get the
likelihood value stored in the estimation table. I would appreciate any
on my code for the meta analysis too. Thanks and happy new year!!

"This is no time to engage in the luxury of cooling off
or to take the tranquilizing drug of gradualism. "    Martin Luther
King, Jr.

Jinseok Kim, Ph.D.
Assistant Professor
College of Social Work
University of South Carolina
Columbia, SC 29208

Tel: 803-576-6082
Fax: 803-777-3498
e-mail: [email protected]
*
*   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/
```