get_icc: Function to calculate the intracluster correlation...

Description Usage Arguments Value Examples

View source: R/get_icc.R

Description

Function to calculate the intracluster correlation coefficient of an indicator collected from random cluster survey (RCS). This is a wrapper of the deff() function in the Hmisc package.

Usage

1
get_icc(x, cluster)

Arguments

x

variable to calculate ICC from

cluster

variable identifying the clusters or groupings of the variable

Value

A vector with named elements n (total number of non-missing observations), clusters (number of clusters after deleting missing data), rho (intra-cluster correlation), and deff (design effect).

Examples

1
2
3
  x <- sample(1:2, size = 25, replace = TRUE)
  cluster <- c(rep(1, 5), rep(2, 5), rep(3, 5), rep(4, 5), rep(5, 5))
  get_icc(x = x, cluster = cluster)

validmeasures/sampsizer documentation built on Sept. 8, 2019, 11:19 p.m.