Learn R Programming

DMAR (version 1.0.0)

icc_lmer: Intraclass Correlation From a Fitted lme4 Mixed-Effects Model

Description

Reads the variance-component decomposition off a fitted lmer model and returns the implied intraclass correlation (ICC) for the specified grouping factor along with a Bonett (2002) Fisher-\(L\)-transform confidence interval, in tidy long form. The bridge function between DMAR's classical- ANOVA path (variance_components_mls, var_icc) and the modern mixed-effects path.

Usage

icc_lmer(fit, group = NULL, conf_level = 0.95)

Value

A data.frame with rows for the point estimate of the ICC, the variance components (between-group and residual), the implied total variance, the Bonett (2002) CI lower/upper limits, and the cluster-level effective sample size used in the CI.

Arguments

fit

A fitted lmer model (class lmerMod) with at least one random-effects grouping factor.

group

Character name of the grouping factor whose ICC is wanted. If NULL (default), the first random-effects grouping factor is used. For three-level models, supply the target level explicitly.

conf_level

Confidence level. Default 0.95.

Author

Ken Kelley [email protected]

Details

Definition. For a two-level model with random intercept by group \(j\) and within-group residual, $$\rho \;=\; \frac{\sigma^2_b}{\sigma^2_b + \sigma^2_w},$$ read directly from VarCorr(fit). For three-level models, the user specifies which level (group) provides the variance contribution; the denominator is the total variance summed across all variance components.

Bonett (2002) CI. The CI is built on the Fisher-style \(L\)-transformation $$L \;=\; \tfrac{1}{2} \log\left(\frac{1 + (k - 1) \rho}{1 - \rho}\right),$$ with variance \(k / (2 (k - 1) (n - 2))\), where \(k\) is the average cluster size and \(n\) is the number of clusters. Back- transformation keeps the bounds in \([0, 1]\).

Limitations. The Bonett CI is built on a balanced / approximately balanced approximation; for severely unbalanced designs the profile likelihood CI from confint(fit, ...) is preferable.

References

Bonett, D. G. (2002). Sample size requirements for estimating intraclass correlations with desired precision. Statistics in Medicine, 21(9), 1331--1335. tools:::Rd_expr_doi("10.1002/sim.1108")

Donner, A. (1986). A review of inference procedures for the intraclass correlation coefficient in the one-way random effects model. International Statistical Review, 54(1), 67--82.

Snijders, T. A. B., & Bosker, R. J. (2012). Multilevel analysis: An introduction to basic and advanced multilevel modeling (2nd ed.). Sage.

See Also

icc, var_icc, variance_components_mls, ss_aipe_icc, lmer

Other agreement and measurement: R2_mixed_effects(), content_validity_index(), gwet_ac(), krippendorff_alpha(), limits_of_agreement(), lin_ccc(), variance_components_mls()

Other mixed models: R2_mixed_effects(), R2_mixed_effects_decomposition(), manova_split_plot(), mixed_anova(), ss_aipe_mixed_effects(), ss_aipe_mixed_effects_sensitivity(), ss_power_mixed_effects(), ss_power_split_plot_anova()

Examples

Run this code
# Twenty groups of six, with a group-level standard deviation of 0.7 on
# top of within-group noise with a standard deviation of 1, so the data
# generating ICC is 0.7^2 / (0.7^2 + 1) = 0.329. The estimate below comes
# with a wide interval: 20 clusters is not many, and the interval is what
# keeps that fact visible.
set.seed(113)
n_grp <- 20; n_per <- 6
grp <- factor(rep(1:n_grp, each = n_per))
y   <- rnorm(n_grp * n_per, 0, 1) + rep(rnorm(n_grp, 0, 0.7), each = n_per)
d <- data.frame(y, grp)
fit <- lme4::lmer(y ~ 1 + (1 | grp), data = d)
icc_lmer(fit)

Run the code above in your browser using DataLab