Skip to content

Instantly share code, notes, and snippets.

@puterleat
Created June 3, 2016 07:20
Show Gist options
  • Save puterleat/e510770a1309dda044650be34b637ada to your computer and use it in GitHub Desktop.
Save puterleat/e510770a1309dda044650be34b637ada to your computer and use it in GitHub Desktop.
Function to calculate ICC for lmer model object
# calculate ICC for lmer model object
icc <- function(m){
vc <- as.data.frame((VarCorr(m)))
l <- vc$vcov
data_frame(grp=vc$grp, icc=sapply(l, function(x){x/sum(l)}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment