Skip to content

Instantly share code, notes, and snippets.

@bbolker
Created May 17, 2025 19:12
Show Gist options
  • Save bbolker/d809ac4400aada384ffd5683f4f3bad9 to your computer and use it in GitHub Desktop.
Save bbolker/d809ac4400aada384ffd5683f4f3bad9 to your computer and use it in GitHub Desktop.
examining ICCs for a singular fit
## https://bsky.app/profile/benjiturnbull.bsky.social/post/3lpevi67z4c2w
library(lme4)
dd <- data.frame(f = factor(rep(1:3, each = 10)))
set.seed(105) ## seed-hack to get a singular fit ...
dd$y <- simulate(~1 + (1|f), newdata = dd,
newparams = list(beta = 0, sigma = 1, theta = 0.01))[[1]]
m <- lmer(y ~ 1 + (1|f), data = dd)
performance::icc(m) ## NA
multilevelTools::iccMixed("y", "f", data = dd) ## ICC(f) == 0
flexplot::icc(m)$icc ## 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment