mixed - Stata
mixed - Stata
mixed - Stata
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
34 <strong>mixed</strong> — Multilevel <strong>mixed</strong>-effects linear regression<br />
Crossed-effects models<br />
Not all <strong>mixed</strong> models contain nested levels of random effects.<br />
Example 10<br />
Returning to our longitudinal analysis of pig weights, suppose that instead of (5) we wish to fit<br />
for the i = 1, . . . , 9 weeks and j = 1, . . . , 48 pigs and<br />
weight ij = β 0 + β 1 week ij + u i + v j + ɛ ij (8)<br />
u i ∼ N(0, σ 2 u); v j ∼ N(0, σ 2 v); ɛ ij ∼ N(0, σ 2 ɛ )<br />
all independently. Both (5) and (8) assume an overall population-average growth curve β 0 + β 1 week<br />
and a random pig-specific shift.<br />
The models differ in how week enters into the random part of the model. In (5), we assume<br />
that the effect due to week is linear and pig specific (a random slope); in (8), we assume that the<br />
effect due to week, u i , is systematic to that week and common to all pigs. The rationale behind (8)<br />
could be that, assuming that the pigs were measured contemporaneously, we might be concerned that<br />
week-specific random factors such as weather and feeding patterns had significant systematic effects<br />
on all pigs.<br />
Model (8) is an example of a two-way crossed-effects model, with the pig effects v j being crossed<br />
with the week effects u i . One way to fit such models is to consider all the data as one big cluster,<br />
and treat the u i and v j as a series of 9 + 48 = 57 random coefficients on indicator variables for<br />
week and pig. In the notation of (2),<br />
⎡ ⎤<br />
u 1<br />
. .<br />
u<br />
u =<br />
9<br />
∼ N(0, G); G =<br />
v<br />
⎢ 1<br />
⎣ . ⎥<br />
.<br />
⎦<br />
v 48<br />
[ ]<br />
σ<br />
2<br />
u I 9 0<br />
0 σvI 2 48<br />
Because G is block diagonal, it can be represented in <strong>mixed</strong> as repeated-level equations. All we need<br />
is an identification variable to identify all the observations as one big group and a way to tell <strong>mixed</strong><br />
to treat week and pig as factor variables (or equivalently, as two sets of overparameterized indicator<br />
variables identifying weeks and pigs, respectively). <strong>mixed</strong> supports the special group designation<br />
all for the former and the R.varname notation for the latter.