[R-sig-ME] Imputation methods mixed model analysis

Fox, John j|ox @end|ng |rom mcm@@ter@c@
Thu Apr 16 16:27:57 CEST 2020


Dear Sam,

By (redundantly) using $ indexing for the Data_F_long data frame to specify the variables in the model formula, you're preventing lmer() from handling the missing data properly. Use the formula Cortisol_pre ~ 1 + (1 | ID instead.

Whether or not you should use multiple imputation (or some other strategy) for the missing data isn't a technical issue about getting lmer() to work but rather a statistical question. Used properly and with default settings in R, lmer() will perform a complete-case analysis, deleting any row in the data set with NAs. If you have a lot of missing data, complete-case analysis can be problematic, and using another approach, such as multiple imputation, can be better. 

If you use multiple imputation, the mice package is a sound implementation. See, for example, the on-line appendix on multiple imputation from Fox and Weisberg, An R Companion to Applied Regression, at <https://socialsciences.mcmaster.ca/jfox/Books/Companion/appendices/Appendix-Multiple-Imputation.pdf>, and the references given there. There are, however, special considerations for multiple imputation in mixed-effects models that aren't discussed in this appendix.

I hope this helps,
 John

  ----------------------------- 
  John Fox, Professor Emeritus
  McMaster University
  Hamilton, Ontario, Canada
  Web: http::/socserv.mcmaster.ca/jfox

> On Apr 16, 2020, at 9:33 AM, Breugelmans, S. (Sara) <S.Breugelmans using student.ru.nl> wrote:
> 
> Dear colleagues,
> 
> 
> For my thesis I am conducting a mixed model analysis on longitudinal data. However, when I tried to run an intercept-only model I got the following error:
> 
> 
> preCORT_ICC <- lmer(Data_F_long$Cortisol_pre ~ 1 + (1 | Data_F_long$ID), data = Data_F_long)
> Error in KhatriRao(sm, t(mm)) : (p <- ncol(X)) == ncol(Y) is not TRUE

> ?
> 
> When I searched this error I saw that it might have to do something with the number of NA's. So then I thought it would be better to use some kind of imputation strategy.
> 
> I was wondering if there is a build-in function in lmer() to do this. Or is it better to manually impute the data before analysing.
> 
> 
> I already found a function called mice(). Does anyone of you have experience with mice() and would you recommend using it?
> 
> 
> Of course it would be more convenient if I could use some kind of build-in function in lmer().
> 
> 
> Thank you for your response!
> 
> 
> Kind regards
> 
> 
> Sam
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list