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

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Tue Apr 8 22:56:05 CEST 2008

On Tue, Apr 08, 2008 at 07:10:16PM +0200, Reinhold Kliegl wrote:
> >  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

I do not believe that this is generally true.  See, for example,

> require(lme4)
> (fm1 <- lmer(Reaction ~ Days + Subject + (Days|Subject),  sleepstudy))

Therefore I am uncertain as to how you can draw this conclusion
without more information about the design (which the poster really
should have provided).

> >  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.) 

I can see the sense behind this position but sometimes a few units are
all that is available, and including them in a model as fixed effects
muddies the statistical waters, especially if they are the kinds of
effects that a model user will be unlikely to naturally condition upon.  

I do agree that if there are problems with model fitting and/or
interpretation when the design is rigorously followed, then a more
flexible approach can and should be adopted, and appropriate
allowances must be made.

> The interpretation of conditional modes (formerly knowns as BLUPs,
> that is "predictions") is a tricky business, especially with few
> units per levels.

Sorry, I think I've missed something.  In what sense are the
conditional modes formerly known as BLUPs?


Andrew Robinson  
Department of Mathematics and Statistics            Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia         Fax: +61-3-8344-4599

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