0
$\begingroup$

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

$\endgroup$

1 Answer 1

0
$\begingroup$

I have been having the same issue and as far as I can tell, it could be related to the type of variable that TIME is. Can you provide some sample data and try TIME as numeric instead of factor?

Here is a resource that further discusses the usage of random intercepts and slopes: https://psyteachr.github.io/stat-models-v1/linear-mixed-effects-models-with-one-random-factor.html

Alternatively, you might not have pseudoreplications in your data and thus a random intercepts only model may be the more appropriate model anyways.

Hopefully someone else with even more stats knowledge can comment here because I am still not certain what the real problem is. I also wanted to pass on this paper that encourages that if you can use a mixed ANOVA, it can more effectively model the random effects than the lme4 approach: Arnqvist, G. (2020). Mixed Models Offer No Freedom from Degrees of Freedom. Trends in Ecology & Evolution, 35(4), 329–335.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.