I want to use a mixed model to test random effects for between subject factors.
Similar questions have been covered before, with answers that it can be done using lme4. (See here and here for some excellent examples.)
However, I want to know if this is possible in the specific context below, to test a theoretical question on variability (I think this question does not overlap with the others).
My data
One dependent variable of task score.
Two between-subject variables
- Group (disease or healthy)
- Comorbidity (a sum of 7 possible simultaneous health conditions)
One within-subject variable
- Task (4 tasks)
(In summary, each subject did all 4 tasks, belongs to only one group, and has only one comorbidity score)
Possible models
So far, I think this model should work
model.1 <- lmer (TaskScore ~
1 + Group + Task + Group*Task + Comorbidity # fixed effects
(1|Subject) + (1 + Task|Subject), # random effects
data)
I interpret the random effects as follows
- (1|Subject) Each subject is expected to be different compared to other subjects, across the tasks (some subjects have low scores across tasks, others have high scores across tasks), thus this measures between-subject variability
- (1 + Task|Subject) Each subject is also expected to be different on each task (each person has low scores on some tasks and high scores on other tasks), thus this measures within-subject variability
However, I also want to measure the following two questions,
- Whether subjects are more different (i.e, between-subject variability is higher) in one group than another, specified below as (1 + Group|Subject)
- Whether each subject is more different across tasks (i.e, within-subject variability is higher) in one group than another, specified below as (1 + Group*Task|Subject)
model.2 <- lmer (TaskScore ~
1 + Group + Task + Group*Task + Comorbidity # fixed effects
(1|Subject) + (1 + Task|Subject), # random effects
(1 + Group|Subject) + (1 + Group*Task|Subject), # more random effects
data)
Question: How can I used a mixed effect model to test variability as outlined above?
First, does model 1 (and my interpretations of it) make sense?
Second, can I make the additions in model 2?
(If not, how can I adapt model 1 to test my questions of interest? Should I be using a different technique altogether?)