Skip to content

Instantly share code, notes, and snippets.

@stonegold546
Last active February 15, 2017 00:07
Show Gist options
  • Save stonegold546/78ed31b40522cdf1cb9a49cbad7382cd to your computer and use it in GitHub Desktop.
Save stonegold546/78ed31b40522cdf1cb9a49cbad7382cd to your computer and use it in GitHub Desktop.
R code for Full maximum likelihood calculation of ICC
# require(lme4)
mymod <- function(data) {
result <- lme4::lmer(y ~ 1 + (1 | x), data = data, REML = FALSE)
sumy <- summary(result)
varb <- sumy$varcor$x[1]
varw <- sumy$sigma ^ 2
icc <- varb / (varb + varw)
c(icc, varb, varw)
}
# mymod(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment