I have a dependent variable Y
recording a score on participants which performed a task measured at three time points. I would like to model the data using a LMM with random intercepts and slopes, with the lme4
package in R:
model<-lmer( Y ~ 1 + TIME + gender + TIME*gender+ (1+TIME|ID) , data = df)
but I obtain the following error when running the code:
Error: number of observations (=408) <= number of random effects (=408) for term (TIME | ID); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable
As far as I understand, this occurs because there is only one observation per subject for each TIME
category (How do you know the number of random effects in a mixed effects model?).
To me it seems reasonable that TIME
is expected to vary within subjects and so I would include as a random effect.
But I wonder if including only ID
as random intercepts without random slopes is just the right model and how can I be sure about that?
Thanks