Generalized Linear Latent and Mixed Models
Speakers 
Sophia RabeHesketh, Andrew Pickles and
Colin Taylor

We describe a Stata program called gllamm that can fit a large number
of generalised linear latent and mixed
models. These models are extensions of the random intercept models
that may be estimated in Stata 6 using xtreg, xtlogit,
xtpois etc. for crosssectional timeseries or other clustered data.
All these models include a random intercept for clusters in the linear
predictor. If there is a single explanatory variable x, the linear
predictor is given by
η_{ij}=β_{0}+β_{1}x_{ij}+u_{i}
where the index ij refers to the ith “level 1”
unit clustered within the jth “level 2” unit, e.g.
observation times within subjects or pupils within schools, and the random
effect u_{i} is usually assumed to have a normal distribution
with mean zero.
The program gllamm allows any combination of five basic extensions to
the random intercept model: (1) discrete random effects distributions, (2)
multilevel models, (3) random coefficients (4) factor loadings and (5)
mixed responses.
Similarly to the xt programs, gllamm requires the data to be
in “long” form with all responses stacked into a single variable
and the cluster index (or indices) stored in separate variable(s).
The program simply uses Stata’s ml commands with method
deriv0 to maximise the likelihood which is evaluated by numerical
integration. The five extensions to the random intercept model are described
below using the examples that are also used in the talk.
 Discrete random effects distributions: We may wish to assume that
there are several latent classes or groups of subjects where each group is
homogeneous in its random effect.
 Multilevel models: The level 2 units may be clustered within level
3 units. For example, there may be multiple observations (k) per person
(j) clustered in families (i). The linear predictor now includes
two random effects, one for families (level 3) and one for subjects (level
2):
η_{ijk}=β_{0}+β_{1}x_{ijk}+u_{i}^{(3)}+u_{j}^{(2)}.
 Random coefficients: The coefficient of an explanatory variable may
differ between level 2 units. For example, the effect of pupil's (j)
maths results in year 3 on maths results in year 5 may differ between schools
(i). The linear predictor now has a random intercept
u_{i}^{(0)} and a random slope
u_{i}^{(1)} where the two random effects may be
correlated,
η_{ij}=β_{0}+ u_{i}^{(0)}+(β_{1}+ u_{i}^{(1)})math3_{ij}.
 Factor loadings: Several variables may load on a latent variable.
For example, on a psychometric test, the results on the items (j)
for each subject (i) could be modelled as a 2parameter Rasch
model
η_{ij}=β_{j}+ u_{i}λ_{j.}
Here the random effect u_{i} is a measure of the subject’s
ability, β_{j} is a measure of the
difficulty of item j and λ_{j} is a “factor loading” representing
the effect of the subject’s ability on their performance on item j. A
separate loading is estimated for each item.
 Mixed responses: If the items or variables are of different types,
e.g. continuous and dichotomous, then different generalised linear models
(families and links) need to be specified for different `observations'. An
example of this is logistic regression with a continuous explanatory or
`exposure' variable which is subject to measurement error. We need to model
the measured exposure and dichotomous outcome simultaneously using
μ_{ij}=β_{0}+ u_{i
}
and
logit(π_{ij})=β_{1}+λu_{i
}
respectively.