In my experiment I want to assess the effect of age on various response variables (all continuously distributed). The experiment is a repeated-measures design with 7 conditions (1 predictor variable with 7 levels). I also have some demographic variables for each subject, and tested whether they correlate with age. There are three demographic variables that correlate with age: d1, d2, and d3, and I want to include these variables in my model. Since we were unable to systematically manipulate age, I think it is important to try to control for any potentially confounding variables.
In a linear mixed-effect model, how do I account for the fact that:
- There are repeated measures for each subject. Doing (1 | subject) seems obvious here.
- The demographic information correlates with age (how do I regress this variable out of the model to look at just the effect of age?)
What I am thinking is to have two random effects terms, but I am not sure if this is the correct approach.
m1 <- lmer(response ~ age * condition +(d1, d2, d3 | age) + (1 | subject), data=data)