l.icc: Calculate the ICC for a Level-1 Variable

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/l.icc.R

Description

Calculates an ICC for a level-1 variable by fitting a two-level unconditional model or unconditional growth model to determine the proportion of variance at each level. The ICC reflects the proportion of variance that is attributed to the higher level (e.g., ICC = 0.40 indicates that 40% of the variance in a variable is at level-2).

Usage

1
2
3
4
5
6
7
8
l.icc(
  data,
  user_id,
  var_id,
  var_type = "continuous",
  time_id = NULL,
  verbose = FALSE
)

Arguments

data

dataset stored as dataframe

user_id

the name of the level-2 grouping variable (i.e., person id); can be stored as a factor, numeric, or integer within a dataframe

var_id

the name of the level-1 variable you want to calculate an ICC for; should be stored as numeric or integer within a dataframe

var_type

the type of level-1 variable you are using, either continuous or binary; defaults to continuous; see Austin & Merlo (2017) for details on how the ICC is calculated with a binary outcome variable

time_id

if included, will calculate the ICC using an unconditional growth model (i.e., time included in the model as a predictor); should be stored as numeric or integer within a dataframe

verbose

if TRUE, outputs a summary statement along with the ICC; defaults to FALSE

Value

returns a value for the ICC

Author(s)

Myles A. Maillet, myles.a.maillet@gmail.com

References

Austin, P.C. & Merlo, J. (2017). Intermediate and advanced topics in multilevel logistic regression analysis. Statistics in medicine, 36(20), 3257-3277.

See Also

l.describe

Examples

1
2
3
l.icc(data = ds, user_id = 'id', var_id = 'l1_var')
l.icc(data = ds, user_id = 'id', var_id = 'l1_var', time_id = 'time')
l.icc(data = ds, user_id = 'id', var_id = 'l1_var', var_type = 'binary', verbose = TRUE)

myles-maillet/long.tools documentation built on Jan. 3, 2021, 12:37 a.m.