I'm trying to run a simple MLM, but I'm bumping into singular fit warnings:
y <- Reduce(c,replicate(10, scale(rnorm(700, 0, 1))))
x <- rep(c("A","B"), each=700, times=10)
g <- rep(c("g1", "g2", "g3", "g4", "g5", "g6", "g7", "g8",
"g9", "g10"), each=7000)
df <- data.frame(y=y, x=x, g=g)
m <- lmer(y ~ x + (1|g), data=df)
boundary (singular) fit: see ?isSingular
I believe the reason for this warning is that there seems to be no variation of the random intercept as ranef(m)
shows.
I read several answers here in CV suggesting to reduce the complexity of the model, often by removing random slopes. However, this model is already as simple as it can get, and there are no random slopes. I also have over 200 groups in my actual data set so it cannot be that I have too few groups.
What are my options? Should I remove the random intercept entirely?
lmer
: namely, that of independence of errors. You use the same 1400 responsesy
in a dataframe of 70000 observations. Could you describe the real-world data you are attempting to model in such an unusual fashion? $\endgroup$y
values $\endgroup$y
is so strange that I wonder whether it reflects your intentions. What would be the problem withy <- rnorm(70000)
in place of the first line? $\endgroup$