# p-value random effect in glmer() in lme4 package

I know that in order to test whether a random effect has a significant impact on a model it's necessary to sequentially remove one random effect at a time and check each model pair with anova() function in lme4 package or through exactLRT() function included in RLRsim package.

However this functions works me well when I worked with lmer() function but not in glmer() function.

In detail, I want to discover if the inclusion of a random effect in my model is significant or not.

model0<-glm(Feed_kg_DM_day~Week, data=dietdef2, family=gaussian(link=log))



If I perform anova(model0, model1) doesn't show me the p-value:

Analysis of Deviance Table

Response: Feed_kg_DM_day

Terms added sequentially (first to last)

Df Deviance Resid. Df Resid. Dev
NULL                  2756     1119.1
Week 14   1.5985      2742     1117.5


How can I know that the effect of random variable is significant?

Thanks a lot,

• If there are repeated measures / clustering then you shouldnt be testing for significance. Unless the estimated variance is extremely small then retain it without seeking a p value. May 26 '19 at 10:33
• And to add to that please read about the many problems with declaring statistical significance, and even more problems when declaring statistical non-significance. May 26 '19 at 11:09
• @FrankHarrell even though in general I agree with you, how do you propose one should judge whether, e.g., a model with nonlinear effects (e.g., using splines) for BMI, age and LDL cholesterol is/fits better than a model with only the nonlinear effect of age? Aren't a likelihood ratio test between the two models and the corresponding p-value useful in determining which model fits better? May 26 '19 at 18:59
• Details in RMS book and course notes. In short, either user a chunk test to decide to keep all or remove all nonlinear terms, or better pre-specific a model that is as complex as the information content in the data will support, and don't look back. If you think the relationships may not be linear, allow them to be nonlinear. May 26 '19 at 20:47