rankICC {rankICC} | R Documentation |
Rank ICC with two hierarchies
Description
rankICC
computes the rank intraclass correlation coefficient (ICC) of a two-level hierarchical distribution. It can be used with any orderable variable, including continuous and discrete variables. Different weighting methods are provided, including methods assigning equal weights to observations or to clusters.
Usage
rankICC(
x,
cluster,
weights = c("obs", "clusters", "ess", "combination"),
conf.int = 0.95,
fisher = FALSE,
na.rm = FALSE,
...
)
Arguments
x |
a numeric or factor vector. |
cluster |
a vector of cluster index corresponding to |
weights |
a character string indicating which weighting method is used. Or an optional vector of user-defined weights to be used. Should be one of the strings |
conf.int |
numeric specifying confidence interval level. |
fisher |
logical, indicating whether to apply Fisher transformation to compute confidence intervals. |
na.rm |
logical. Should missing values be removed? |
... |
additional arguments to be passed to the iteration function if |
Details
"obs"
assigns equal weights to observations; p_{ij} = 1/N
, where N is the total number of observations. "clusters"
assigns equal weights to clusters; p_{ij} = 1/(nk_i)
, where n is the total number of clusters and k_i is the cluster size. "ess"
and "combination"
implement iterations until convergence; p_{ij}(\gamma_I)=1/(1+k_i\gamma_I)/\{\sum_{j=1}^n k_j/(1+k_j\gamma_I)\}
for "ess"
, p_{ij}(\gamma_I)=(1-\gamma_I)/N+\gamma_I/(nk_i)
for "combination"
.
Value
a vector with following components.
rankICC | the rank ICC. |
SE | the standard error. |
Lower, Upper | the lower and upper bound of the confidence interval. |
References
Tu, S., Li, C., Zeng, D., and Shepherd, B. E. (2023). Rank intraclass correlation for clustered data. Statistics in Medicine 42, 4333-4348.
Examples
k <- 50; m <- 5
sigma.u <- 1; sigma.e <- 2
u <- rnorm(k, 5, sigma.u)
x1 <- matrix(NA, k, m)
for (i in 1:k){
x1[i,] <- u[i] + rnorm(5, 0, sigma.e)
}
x <- as.vector(t(x1))
cluster <- rep(1:k, each=5)
rankICC(x, cluster, weights = "clusters")
rankICC(x, cluster, weights = "ess", tol = 1e-4, maxIter = 10)