I am working with a large dataset and analyzing a continuous dependent variable with a linear mixed effects model using the R package lme4. I am also using the extension lmerTest, which allows to compute various plots and the p-values associated with fixed and random terms.
When I run the rand()
to obtain a p-value associated with each random term, I obtain the following error:
Error in anova.merMod(object = object, ... = ...) : models were not all fitted to the same size of dataset
This is because one of my random terms includes missing values, while others don't.
My question is: within the rand
function, how can I deal with differences in dataset sizes? Is there an argument that allows to automatically omit NAs? I tried to look at the help page for that function but the documentation is very limited.
Thanks!