The goal of iccmult is to estimate the intracluster correlation
coefficient (ICC) of clustered categorical response data. It provides
two estimation methods, a resampling based estimator and the method of
moments estimator. These are obtained by specifying a method in the
function iccmulti::iccmult()
. This package also includes a
function to generate simulated clustered categorical response data:
iccmulti::rccat()
.
You can install iccmult from within R or RStudio with:
install.packages("iccmult")
Alternatively, install the package from GitHub with:
# install.packages("pak")
::pak("ncs14/iccmult") pak
This is a basic example which shows you how to generate clustered
categorical response data. The response probabilities must sum 1 and the
desired ICC must be a value between 0 and 1. The number of clusters is
set to 20 and each cluster is of size 25. The output of
rccat
is a two column data frame of a cluster identifier
and a categorical response vector.
library(iccmult)
<- rccat(rho=0.25, prop=c(0.2,0.3,0.5), noc=20, csize=25) clustdat3
The iccmulti()
function is called as follows to estimate
the ICC on the resulting data frame. The function expects two variables:
a cluster identifier and the categorical response vector. The call below
requests both the resampling and the moments estimates.
<- iccmulti(cid, y, clustdat3, method=c("rm","mom")) iccclust
The result is a list of length two, each component holding the estimated ICC, se(ICC), and confidence interval bounds from each estimation method.