[R-sig-ME] Random or Fixed effects appropriate?

Reinhold Kliegl reinhold.kliegl at gmail.com
Tue Apr 8 19:10:16 CEST 2008


>  My dataset has one continuous normally-distributed fixed effect and
>  four random effects that are nested (in fact, it is a taxonomy). For
>  simplicity, I've removed the variable names, so the dataset has the
>  following structure:
>
>  y ~ x | A/B/C/D
It would be good to know how many units/levels you have for each of
your four random effects. Those with fewer than, say, five, are good
candidates for being specified as fixed effects. Think how many
observations you need to get a stable estimate of a variance!

>  lmer( y ~ x + (1|A) + (1|B) + (1|C) + (1|D) + C + x:C) #error:
>  Downdated X'X is not positive definite, 82
You cannot include C both as a random and a fixed effect

>  lmer( y ~ x + (1|A) + (1|B) + (1|C) + (1|D) + x:C) #gives sensible results
If this gives sensible results, I suspect you have very few levels of
C, say, 2 or 3?
In this case, definitely specify C and x and their interaction as
fixed effects, e.g.:
lmer( y ~ x*C + (1|A) + (1|B)  + (1|D)

The following may not apply to your case, but it might: Sometimes
people think that a nested/taxonomic design implies a random effect
structure (e.g., schools, classes, students). This is not true. If you
have only a few units for each factor, you are better off to specify
it as a fixed-effects rather than a random-effects taxonomy. (Of
course, you lose generalizability, but if you want this you should
make sure you have sample that provides a basis for it.) The
interpretation of conditional modes (formerly knowns as BLUPs, that is
"predictions") is a tricky business, especially with few units per
levels.

Reinhold




More information about the R-sig-mixed-models mailing list