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]

Re: st: Re: three-level gllamm - variable as a nesting variable or a predictor?

From   "Joseph Coveney" <>
To   <>
Subject   Re: st: Re: three-level gllamm - variable as a nesting variable or a predictor?
Date   Tue, 8 Oct 2013 14:31:43 +0900

Lisa Marie Yarnell wrote:

Thanks, Joseph.  The two segments of the study are ascending and
descending halves of a drinking experience; we are studying
alcoholism.  A person in the ascent (Segment A) has different
physiological and mental symptoms than in the descent (Segment B).  So
perhaps this is like repeated measures and suggests a two-level model,
as you said?  But it is not a cross-over study per se, with two
different treatments.  It is just the two halves of a drinking

In the Stata output, when I constructed the model (again with 305
observations placed into either Segment A or Segment B, nested within
31 individuals), the Stata output showed:
number of level 1 units = 305
number of level 2 units = 62
number of level 3 units = 31

I was confused at first because there are only really 2 levels of
Level 2 (Segment A and Segment B).  I wondered why the output shows 62
units at Level 2.  But my thought was that Stata recognizes the
three-level structure that I specified, and knowing that the Level 2
units are nested in 31 Level 1 persons, it indicates 62 units at Level

Can you explain why the Stata output would show 62 units at Level 2?

Frankly, the way I had specified this model, I am not sure how I would
depict this graphically--it seems mixed-up in some place.

I will think about the alternative model that you suggested:


Take a glance at my earlier post's mention of uniqueness to understand what's
going on here.  By analogy, it's as if you have selected 31 families that have
exactly two children each, and that have named one child "A" and the other "B".
Despite the families' children's identical names, they are all unique:  the
child named "A" of the Family ID 1234 is not the same as the child named "A" of
Family ID 5678, and you would assign separate IDs to the two children who share
the same name; moreover, the two children, "A" & "B", within a family are
exchangeable (conditional on covariates of interest, if any) in that they can be
viewed as randomly drawn from the populations that they represent--a
(hypothetical) population of children of the one family and a separate
(hypothetical) population of children of the other family.

That is not what you have in your alcoholism study.  Segment A for Study
Participant No. 1234 is not unique, but rather is the same as Segment A for
Study Participant No. 5678.  Both Segments A are conceptually the same, because
Study Segment A is as operationally defined in your study's protocol.  Likewise
for Study Segment B.  You don't conceive of Study Segments A and B for Study
Participant 1234  as unique, exchangeable members of a Population of Study
Segments belonging exclusively to (nested under) Study Participant 1234.

Why does -gllamm- show 62 units at Level 2?  It is because behind the scenes
-gllamm- generates 62 unique Level-2 IDs in accordance with your model
specification in the same way that nested factors were (are still) generated in
conventional ANOVA:  if the user doesn't already specify 62 unique IDs for all
of the levels of the nested factor, then the software generates them internally
by forming an interaction term of the higher (nesting) factor and the lower
(nested) factor, and then dropping the main effects term for the nested factor,
as in -anova . . . group / patient_id|group- . . .  It makes no sense to test
the differences between levels of the nested factor, because the nested factor
level indicator is viewed as just a counter (in lieu of an ID number) for the
number of unique individuals under a given particular level of the nesting
factor.  In your three-level model specification, the variable *segment* is a
counter variable (and A and B are arbitrary units of a counter) to indicate how
many study segments Study Participant 1234 has, how many Study Participant 5678
has and so on.  You specified a three-level hierarchy, and to -gllamm-, in your
case, each study participant just happens to have exactly two nested (unique,
exchangeable) study segments randomly drawn from the participant's own
population of study segments.  That's why you happen to have exactly double the
number of second-level units as top-level units.

Again, I recommend that you reconsider your -gllamm- model specification as
two-level, with segment as a repeated-measures variable (cross-over indicator
variable), optionally with a random slope (or two random intercepts, one for
each segment type).  I believe that proper graphical depiction will become more
readily apparent and that the model will not seem so mixed up.

Joseph Coveney

*   For searches and help try:

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