Package 'iccmult'

Title: Intracluster Correlation Coefficient (ICC) in Clustered Categorical Data
Description: Assists in generating categorical clustered outcome data, estimating the Intracluster Correlation Coefficient (ICC) for nominal or ordinal data with 2+ categories under the resampling and method of moments (MoM) methods, with confidence intervals.
Authors: Nicole Solomon [aut, cre, cph]
Maintainer: Nicole Solomon <[email protected]>
License: MIT + file LICENSE
Version: 1.0.1
Built: 2025-03-01 06:23:04 UTC
Source: https://github.com/ncs14/iccmult

Help Index


Estimate ICC for nominal or ordinal categorical response data

Description

Estimate ICC for nominal or ordinal categorical response data

Usage

iccmulti(
  cid,
  y,
  data,
  alpha = 0.05,
  method = c("rm", "mom"),
  binmethod = c("aov", "aovs", "keq", "kpr", "keqs", "kprs", "stab", "ub", "fc", "mak",
    "peq", "pgp", "ppr", "rm", "lin", "sim"),
  ci.type = c("aov", "wal", "fc", "peq", "rm"),
  kappa = 0.45,
  nAGQ = 1,
  M = 1000,
  nowarnings = FALSE
)

Arguments

cid

Cluster id variable.

y

Categorical response variable.

data

Dataframe containing 'cid' and 'y'.

alpha

Significance level for confidence interval computation. Default is 0.05.

method

Method used to estimate categorical ICC. A single method or multiple methods can be specified. Default is both resampling and moments estimators. See iccmult::iccmulti for more details.

binmethod

Method used to estimate binary ICC. A single or multiple methods can be specified. By default all 16 methods are returned. See full details in ICCbin::iccbin().

ci.type

Type of confidence interval to be computed for binary ICC. By default, all 5 types will be returned See full details in ICCbin::iccbin() for more.

kappa

Value of Kappa to be used in computing Stabilized ICC when the binary response method 'stab' is chosen. Default value is 0.45.

nAGQ

An integer scaler, as in lme4::glmer(), denoting the number of points per axis for evaluating the adaptive Gauss-Hermite approximation to the log-likelihood. Used when the binary response method 'lin' is chosen. Default value is 1.

M

Number of Monte Carlo replicates used in binary ICC computation method 'sim'. Default is 1000.

nowarnings

Flag to turn off estimation warnings. Default is False.

Value

Data frame or list of data frames with single column estimate of ICC, se(ICC), and lower and upper CI bounds.

Examples

iccdat4 <- rccat(rho=0.15, prop=c(0.15,0.25,0.20,0.40), noc=10, csize=25)
iccmulti(cid=cid, y=y, data=iccdat4)
iccdat3 <- rccat(rho=0.10, prop=c(0.30,0.25,0.45), noc=15, csize=50)
iccmulti(cid=cid, y=y, data=iccdat3)

Generate Correlated Clustered Categorical Data

Description

Generate Correlated Clustered Categorical Data

Usage

rccat(
  rho,
  prop,
  prvar = 0,
  noc,
  csize,
  csvar = 0,
  allevtcl = TRUE,
  drawn = 10,
  nowarnings = FALSE
)

Arguments

rho

Numeric value between 0 and 1 of the desired ICC value.

prop

Numeric vector of each response category's probability, each taking value between 0 and 1.

prvar

Numeric value or vector of values between 0 and 1 denoting percent variation in each assumed event rate. Default is 0.

noc

Numeric value of number of clusters to be generated.

csize

Numeric value of desired cluster size.

csvar

Numeric value between 0 and 1 denoting percent variation in cluster sizes. Default is 0.

allevtcl

Logical value specifying whether all clusters must have all categories. Default is True.

drawn

Maximum number of attempts to apply variation to event probabilities.

nowarnings

Flag to turn off warnings. Default is False.

Value

Dataframe with two columns, a column identifier 'cid' and categorical response 'y', and one row for each observation within each cluster

Examples

rccat(rho=0.2, prop=c(0.2, 0.3, 0.5), prvar=0, noc=5, csize=20, csvar=0.2)
rccat(rho=0.1, prop=c(0.2, 0.4, 0.3, 0.1), prvar=0.10, noc=30, csize=40, csvar=0)