# R: How to “control” for another variable in Linear Mixed Effects Regression model?

Essentially, I have two collinear variables which could be seen as either random or as fixed effects, a dependent variable I'm fitting the model to, and a variable that's assuredly a random effect.

Dependent var: Number of neuron spikes (FiringRate) in a specific region of mousebrain

Fixed effects:

1) Time at which data sample was taken (on a linear scale in days -- so day two would be 2, day 5 would be 5, and so on)

2) The Age of the mouse in days (so there's definitely collinearity between this and the Time variable, but there are enough mice of different ages to make this worthwhile as a separate variable)

Random effect: Subject -- "Name" (ID number) of the mouse

Essentially, I'm wondering if it would be appropriate to run two LMEs. In the first, I'd treat Age and Subject as random variables in order to control for the effects of Age (and thus the collinearity between Age and Time) and see if Time is a significant predictor of the # of spikes (dependent variable). In the second, I'd enter Time and Subject as random variables to see if Age was a significant predictor.

library(lme4)
a = lmer(FiringRate ~ Time + (1|Age) + (1|Subject))
b = lmer(FiringRate ~ Age + (1|Time) + (1|Subject))

-
It seems to me model b makes more sense, since you could imagine fixed developmental effects occurring at particular ages in all mice, but occasion specific conditions (captured by the random intercept, grouped by time) may be more thought of as random perturbations. –  Macro Apr 6 '12 at 1:48
Thanks, I can see that... –  Julie Apr 6 '12 at 3:05

I don't think the issues here can be addressed in a simple answer posted online. I would add:

1. the inclusion of age and time is problematic and should be thought through. It is unclear to me what the benefit is of having both variables in the model. It can be done. But not by avoiding the issue by making one of the variables a random effect.
1.5. if you want to include age, from what I understand, include age as age at start of experiment. This should not be collinear with other data and should be informative.
2. I would be very reluctant to include Age and time as random effects in this model. An assumption of the random effects model is that clusters are exchangeable.
2.5. There is a tendency in the R code I've seen to include multiple random effects. I'm not sure why. Once you go beyond a single random effect, or simple single random effect clustered in another, the model complexity is significant and often not warranted.
3. I don't think the models as written make sense. The following makes sense to me and are defensible:

lmer(FiringRate~ Time + (1|Subject))

lmer(FiringRate~ Time + (Time|Subject))

lmer(FiringRate~ Time + age_atstart + (Time|Subject))

-