Package 'iccCompare'

Title: Comparison of Dependent Intraclass Correlation Coefficients
Description: Provides methods for testing the equality of dependent intraclass correlation coefficients (ICCs) estimated using linear mixed-effects models. Several of the implemented approaches are based on the work of Donner and Zou (2002) <doi:10.1111/1467-9884.00324>.
Authors: Josep Lluis Carrasco [aut, cre], Gonzalo Peon Pena [aut]
Maintainer: Josep Lluis Carrasco <[email protected]>
License: GPL (>= 2)
Version: 1.1.0
Built: 2026-05-17 09:55:59 UTC
Source: https://github.com/cran/iccCompare

Help Index


Tests the equality of dependent ICCs

Description

Tests the equality of dependent ICCs

Usage

icc_dep_test(
  data,
  ry,
  rind,
  rtype,
  alpha = 0.05,
  Wald = FALSE,
  WL = 1:2,
  Boot = FALSE,
  nboot = 500,
  Perm = FALSE,
  nperm = 100,
  parallel = TRUE,
  workers = 15,
  future_seed = NULL,
  progress = TRUE
)

Arguments

data

A data frame with (at least) three columns: the outcome, the subject and the setting identifiers.

ry

Character string. The outcome variable.

rind

Character string. The subject identifier.

rtype

Character string. The setting identifier.

alpha

Numeric. Significance level. Default to 0.05.

Wald

Logical. Should the Wald test be run? Default is FALSE

WL

Vector of length two. Which pair of settings should be compared using the Wald test? The first two settings are the default.

Boot

Logical. Should bootstrap be run? Default is FALSE.

nboot

Numeric. Number of bootstrap resamples. Default is 500.

Perm

Logical. Should permutations test be run? Default value is FALSE.

nperm

Numeric. Number of permutations. Default value is 100.

parallel

Logical. Use parallel computation? Default value is TRUE.

workers

Numeric. Number of cores used in parallelization. Default value is 15.

future_seed

Logical/Integer. The seed to be used for parallellization. Further details in furrr_options.

progress

Logical. If TRUE a progress bar is created while computing bootstrap and permutations. Default value is TRUE

Details

The variance components required for ICC estimation are obtained using a linear mixed-effects model that accounts for correlations across settings. The null hypothesis of equality between dependent ICCs is evaluated through the following methods:

- Wald test based on Fisher’s Z and Konishi–Gupta transformations, using either asymptotic or bootstrap standard errors;

- Chi-square test with asymptotic or bootstrap standard errors;

- Permutation test.

Value

The output is a list with the following components:

  • Model. Object of class lme with the fitted model estimates.

  • Estimates. List containing three objects: 1) a matrix with the ICCs etimates; 2) the variance-covariance matrix of the ICC estimates; 3) Confidence intervals of the ICC estimates.

  • p_values. List with the computed p-values testing the equality of the ICCs.

  • boot_res. List with three objects: 1) bootstrap estimates of the ICCs; 2) mean of the bootstrap ICC estimates; 3) variance-covariance matrix of the ICC estimates obtained by bootstrapping.

  • perm_res. List with three elements: 1) P-value obtained by permutations to test the equality of the ICCs; 2) Vector containing the sum of the squared differences between the ICCs obtained in each permutation; 3) the sum of the squared differences between the ICCs obtained in the original sample.

Examples

sin_res_b<-icc_dep_test(sin_data,ry="Sinuosity",rind="id",rtype="Section",alpha=0.05,Wald=TRUE,
WL=1:2,)


sin_res<-icc_dep_test(sin_data,ry="Sinuosity",rind="id",rtype="Section",alpha=0.05,Wald=TRUE,
                     WL=1:2,Boot=TRUE,nboot=500,Perm=TRUE,nperm=100,
                     parallel=TRUE,workers=15,future_seed = NULL,progress=TRUE)



dia_res<-icc_dep_test(cccrm::bpres,ry="DIA",rind="ID",rtype="METODE",alpha=0.05,Wald=TRUE,
WL=1:2,Boot=TRUE,nboot=500,Perm=TRUE,nperm=100,
parallel=TRUE,workers=15,future_seed = NULL,progress=TRUE)

Tests the equality of dependent ICCs using the likelihood ratio test (LRT)

Description

Tests the equality of dependent ICCs using the likelihood ratio test (LRT)

Usage

ICC_LR_test(data, ry = "y", rind = "ind", rtype = "type", optimizer = "nlminb")

Arguments

data

A data frame with (at least) three columns: the outcome, the subject and the setting identifiers.

ry

Character string. The outcome variable.

rind

Character string. The subject identifier.

rtype

Character string. The setting identifier.

optimizer

Optimization function to use. For further details see mle2

Details

The null hypothesis of equality of dependent ICCs is tested using the likelihood ratio test (LRT) proposed in Donner and Zou (2002).

Value

The output is an object of class htest with the following components:

  • null.value. Vector. The value of the ICC in the null hypothesis of equality of ICCs.

  • estimate. Vector. The estimates of the ICC

  • statistic. Numerical. The value of the LR statistic.

  • p.value. Numerical. The value of the LR statistic.

References

Donner, A. and Zou, G. (2002). Testing the equality of dependent intraclass correlation coefficients. Journal of the Royal Statistical Society: Series D (The Statistician), 51(3):367–379

Examples

sin_res<-ICC_LR_test(sin_data,ry="Sinuosity",rind="id",rtype="Section")

Sinuosity data

Description

A data frame containingthe sinuosity index from 90 trajectories

Usage

sin_data

Format

A data frame containingt he sinuosity index from 388 trips of 36 gulls

Sinuosity

Sinuosity index

id

Subject identifier

Section

Time section where the trip started: Day or Night