Bookmark and Share

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

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

[no subject]

If you look at the Stata documentation for the official -melogit- command,
you'll see the difference:  its example of a three-level model has a *unique*
subject nested under a family.  Even with cross-classified random effects, each
of the two factors has a property of uniqueness (for example, in the classic
example of students nested in schools who transfer to other schools, both
students and schools are unique).

So, from your description of the circumstances, the model for -gllamm- would
look something like:

generate byte cons = 1
eq idc: cons
eq ids: segment
gllamm drivesf gender aldh2cent braccent segment, ///
    i(id) nrf(2) eqs(idc ids) ///
    family(binomial) link(logit) adapt 

You can find an analogous model (two-level logistic with a random slope) in the
examples for the study of contraceptive use in the documentation for the
official -melogit-; take a look at how the variable "urban" is handled, for

melogit c_use urban age child* || district: urban, cov(unstruct)

You're probably aware that a sample size of 31 persons might be considered a
little lightweight for these kinds of methods; you might even have difficulty
with convergence.  I don't know what drivesf is, but if it's discretized, then
maybe you can leave it as continuous and use a fixed-effects linear model
(-xtreg , fe-) and take advantage of the small-sample test statistics that you
get with it for the difference between study segments.  (Time-invariant
variables, such as sex, will drop out of the fixed-effects model, but will
remain in the complementary -xtreg , be-.)

Joseph Coveney

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index