Statalist


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

st: a question for the multivariate random coefficients model using GLLAMM


From   duncan zheng <[email protected]>
To   [email protected]
Subject   st: a question for the multivariate random coefficients model using GLLAMM
Date   Thu, 14 Jan 2010 09:15:37 +0800

hi Statalist,

I've found that in many books and papers, examples about the
random-coefficient model using 'gllamm' only include only one variable
allowed for random coefficient. I want to build up a model including
more than one variable allowed for the random coefficient. For
example, according to Sophia & Anders' book Multilevel and
Longitudinal Modeling Using Stata P146-158, my model should be

Yij=β1+β2 lrt+β3schav+ξ1j+ξ2j lrt+ξ3j schav+εij

This includes two variables 'lrt' and 'schav'. I assume that the
covariance matrix was
τ=   ■(ψ11&ψ12&ψ13@ψ21&ψ22&ψ23@ψ31&ψ32&ψ33)

=  ■(var(ξ1j|lra,schav)&cov(ξ1j,ξ2j|lra,schav)&cov(ξ1j,ξ3j|lra,schav)@cov(ξ2j,ξ1j|lra,schav)&var(ξ2j|lra,schav)&cov(ξ2j,ξ3j|lra,schav)@cov(ξ3j,ξ1j|lra,schav)&cov(ξ3j,ξ2j|lra,schav)&var(ξ3j|lra,schav))

I set equations for inter and slope respectively as follows:
. gen cons=1
. eq inter:cons
. eq slope:lrt schav

To finish program "gllamm gcse lrt schav,i(school) nrf(2) eqs(inter
slope) ip(m) nip(15) adapt", having no set the star values for
computing, the result I got was:

gllamm gcse lrt schav,i(school) nrf(2) eqs(inter slope) ip(m) nip(15) adapt
number of level 1 units = 4059
number of level 2 units = 65

Condition Number = 317.56356

gllamm model

log likelihood = -14002.461

gcse       Coef.   Std. Err.            z P>z [95% Conf. Interval]
lrt      .5536729   .0200091        27.67 0.000 .5144558 .59289
schav    1.202866   .5645719     2.13 0.033 .0963259 2.309407
_cons   -2.658444   1.208787    -2.20 0.028 -5.027622 -.2892659

Variance at level 1
55.370349 (1.2494905)

Variances and covariances of random effects
***level 2 (school)
var(1): 6.6744527 (1.5422225)
cov(2,1): .02919465 (.12183525) cor(2,1): .09411644
var(2): .01441651 (.00459126)

loadings for random effect 2
lrt: 1 (fixed)
schav: 3.0914009 (3.5706898)

As was shown above, I can't point out
var(ξ1j|lra,schav), var(ξ2j|lra,schav) and var(ξ3j|lra,schav). I can't
figure out all co-variances respectively, and I don't understand the
last three red lines' meaning exactly. Can you give me further
explanation about these?

Another question is how I can set the star values for computing.
As below:
. gllamm gcse lrt schav,i(school) adapt
. estimates store rig
. gen cons=1
. eq inter:cons
. eq slope:lrt schav
. matrix a=e(b).
. matrix a=(a,0,0,0)
. gllamm gcse lrt schav,i(school) nrf(2) eqs(inter slope) ip(m)
nip(15) adapt from(a) copy
Running adaptive quadrature
Iteration 0:    log likelihood = -14020.987
(error occurred in ML computation)
(use trace option and check correctness of initial model)

I think there should be something wrong with my setting value.
Whereas when I set the star values as matrix a=(a,.5,.1,.2), the
program finished successfully.
The result show that
. gllamm gcse lrt schav,i(school) nrf(2) eqs(inter slope) ip(m)
nip(15) adapt from(a) copy
log likelihood = -14002.503

gcse Coef. Std. Err.      z    P>z [95% Conf. Interval]
lrt            .5536594 .020099   27.55     0.000    .514266           .5930527
schav       1.170598 .5637334   2.08 0.038   .0657008           2.275495
_cons -2.554637 1.216821  -2.10 0.036  -4.939563          -.1697109
Variance at level 1
 55.364746 (1.2492625)

Variances and covariances of random effects
***level 2 (school)
    var(1): 7.2082699 (1.8332009)
   cov(2,1): .09016604 (.09988308) cor(2,1): .27814664
    var(2): .01457831 (.00462039)

    loadings for random effect 2
   lrt: 1 (fixed)
schav: 1.2700516 (2.5486213)

Thanks a lot.

Sincerely yours,
Zheng Dachuan
2010/1/14

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index