iccMixed {multilevelTools}R Documentation

Intraclass Correlation Coefficient (ICC) from Mixed Models

Description

This function estimates the ICC from mixed effects models estimated using lme4.

Usage

iccMixed(dv, id, data, family = c("gaussian", "binomial"))

Arguments

dv

A character string giving the variable name of the dependent variable.

id

A character vector of length one or more giving the ID variable(s). Can be more than one.

data

A data.table containing the variables used in the formula. This is a required argument. If a data.frame, it will silently coerce to a data.table. If not a data.table or data.frame, it will attempt to coerce, with a message.

family

A character vector giving the family to use for the model. Currently only supports “gaussian” or “binomial”.

Value

A data table of the ICCs

References

For details, see Campbell, M. K., Mollison, J., and Grimshaw, J. M. (2001) <doi:10.1002/1097-0258(20010215)20:3 "Cluster trials in implementation research: estimation of intracluster correlation coefficients and sample size."

Examples

iccMixed("mpg", "cyl", mtcars)
iccMixed("mpg", "cyl", data.table::as.data.table(mtcars))
iccMixed("mpg", "cyl", data.table::as.data.table(mtcars), family = "gaussian")
iccMixed("mpg", c("cyl", "am"), data.table::as.data.table(mtcars))
iccMixed("am", "cyl", data.table::as.data.table(mtcars), family = "binomial")

[Package multilevelTools version 0.1.1 Index]