I find this post relevant. The mock data-set is constructed the same way as in the post but with a different seed to produce zero variance in the mixed model. Think this as a three way anova, with A as temperature factor, B as day factor and C as replicate. The output of fit1 gives a SD of 0.455 for subject, and anova with p-value 0.02483 suggests a significant non-zero SD. I did some research and find this chi-square test is a conservative test considering it is on the boundary, so p-value should have been even lower. My question is whenever we see zero SD for some factors (in fit1, SD for factors A and B are zero), does this imply that the variance estimates for other factors are not reliable? The residual SD is correctly estimated to be 1 though.
> set.seed(8)
> d <- data.frame(
+ Y = rnorm(96),
+ subject = factor(rep(1:12, 4)),
+ A = factor(rep(1:2, each=24)),
+ B = factor(rep(rep(1:2, each=12))),
+ C = factor(rep(rep(1:2, each=48))))
>
> fit1 <- lmer(Y ~ (1|subject) + (1|A) + (1|B), data=d)
>
> fit2 <- lmer(Y ~ (1|A) + (1|B), data=d)
>
> fit1
Linear mixed model fit by REML ['lmerModLmerTest']
Formula: Y ~ (1 | subject) + (1 | A) + (1 | B)
Data: d
REML criterion at convergence: 286.2724
Random effects:
Groups Name Std.Dev.
subject (Intercept) 0.455
A (Intercept) 0.000
B (Intercept) 0.000
Residual 1.008
Number of obs: 96, groups: subject, 12; A, 2; B, 2
Fixed Effects:
(Intercept)
-0.09281
>
> anova(fit1,fit2)
refitting model(s) with ML (instead of REML)
Data: d
Models:
fit2: Y ~ (1 | A) + (1 | B)
fit1: Y ~ (1 | subject) + (1 | A) + (1 | B)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
fit2 4 297.52 307.78 -144.76 289.52
fit1 5 294.48 307.31 -142.24 284.48 5.0357 1 0.02483 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1