2
$\begingroup$

I am dealing with a dataset with the majority of entries with one value per individual but, with three cases with 2 repeated measures each. My first approach would be to pursue linear mixed models, to account for the repeated entries.

I've recreated a workable example:

set.seed(123) 
ss<-data.frame(ID=c(paste0("ID",seq(1:100)),rep(c("ID101","ID102","ID103"),2)),
                   expl=rnorm(106),dep=rnorm(106))
    
lmerTest::lmer(dep~expl+(1+expl|ID),data=ss)

This model makes sense to me, considering that for each measure of ID101, 102 and 103 the intercept and the slope for 'expl" may be different. Nevertheless, as it is expected, an error is produced:

Error: number of observations (=106) <= number of random effects (=206) for term (1 + expl | ID); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable

Should I try to simplify the mixed model to include only the intercept? Or should I try another approach?

Thanks in advance!

$\endgroup$
2
$\begingroup$

You will need to simplify the model, since you are trying to fit 206 random effects when you have only 106 observations.

dep ~ expl + (1|ID) 

would be the appropriate model in this case. Or if you feel that the random slopes are more important:

dep ~ expl + (0 + expl|ID)
$\endgroup$
3
  • $\begingroup$ Thanks for you response! Indeed I am thinking about to do this but, I don't know then if it is oversimplified (both the intercept and slope are relevant from the user perspective)... Do you know if there is any different way to analyze this type of dataset? $\endgroup$ – André Barros Jun 19 at 10:46
  • $\begingroup$ Your data do not support a model with random slopes and random intercepts. The usual approach is to omit the random slopes. You could also investigate how important random slopes are by fitting the model without the intercepts - you might want to consider centering the expl variable in that case. But ultimately if you don't have enough data, there is nothing you can do $\endgroup$ – Robert Long Jun 19 at 10:50
  • $\begingroup$ Does this answer your question ? If so please consider marking it as the accepted answer. If not, please let us know why. Also, if you haven't already, please consider upvoting it. $\endgroup$ – Robert Long 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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