Package 'ICC'

Title: Facilitating Estimation of the Intraclass Correlation Coefficient
Description: Assist in the estimation of the Intraclass Correlation Coefficient (ICC) from variance components of a one-way analysis of variance and also estimate the number of individuals or groups necessary to obtain an ICC estimate with a desired confidence interval width.
Authors: Matthew Wolak [cre, aut]
Maintainer: Matthew Wolak <[email protected]>
License: GPL (>=2)
Version: 2.4.0
Built: 2024-11-04 21:42:26 UTC
Source: https://github.com/matthewwolak/icc

Help Index


Facilitating Estimation of the Intraclass Correlation Coefficient

Description

Assist in the estimation of the Intraclass Correlation Coefficient (ICC) from variance components of a one-way analysis of variance and also estimate the desired confidence interval width.

Author(s)

Maintainer: Matthew Wolak [email protected]

See Also

Useful links:


Optimum k Measures Based Upon a Fixed Total Researcher Effort

Description

Given a fixed researcher effort (e.g., total number of assays able to be run), this function plots the optimum k measurements per individual to use in order to obtain the smallest confidence interval at an expected intraclass correlation coefficient (ICC) estimate. The results are depicted graphically, showing the tradeoff in confidence interval width with changing k.

Usage

effort(
  est.type = c("hypothetical", "pilot"),
  e = NULL,
  ICC = NULL,
  x = NULL,
  y = NULL,
  data = NULL,
  alpha = 0.05
)

Arguments

est.type

A character string of either "hypothetical" indicating usage of the given values of effort (e) and intraclass correlation coefficient (ICC) or if "pilot" is specified then to calculate these from the dataset provided. Just the first letter may be used.

e

A numeric value indicating the total effort (n individuals times k measurements per individual). May be a vector of effort levels.

ICC

A numeric value of the expected intraclass correlation coefficient.

x

Column name of data indicating the individual or group ID from a pilot study.

y

Column name of data indicating the measurements from a pilot study.

data

A data.frame from a pilot experiment.

alpha

A numeric indicating the alpha level to use when estimating the confidence interval.

Details

More than one e may be given. In this case, the graphical result portrays multiple lines - each representing a different e.

When est.type="pilot", the function automatically generates an effort 10 percent larger and smaller than the calculated effort from the pilot data.

Author(s)

[email protected]

See Also

Nest

Examples

#Example 1
  effort(est.type = "h", e = c(30, 60, 120), ICC = 0.2)
#Example 2
  data(ChickWeight)
  effort(est.type = "p", x = Chick, y = weight, data = ChickWeight)

Estimate the Intraclass Correlation Coefficient (ICC)

Description

Estimates the ICC and confidence intervals using the variance components from a one-way ANOVA.

Usage

ICCbare(x, y, data = NULL)

ICCbareF(x, y, data = NULL)

ICCest(x, y, data = NULL, alpha = 0.05, CI.type = c("THD", "Smith"))

Arguments

x

A column name indicating individual or group id in the dataframe data.

y

A column name indicating measurements in the dataframe data.

data

A data.frame containing x and y.

alpha

A numeric specifying the alpha level to use when estimating the confidence interval. Default is 0.05.

CI.type

A character indicating the particular confidence interval to estimate. Can be specified by just the first letter of the name. See Details section for more.

Details

ICCbare conducts simple estimation of the ICC that is meant to be as simple as possible and fast for use in Monte Carlo simulations or bootstrapping. If the design is balanced, ICCbare will calculate variance components 'by hand', instead of using the aov function. ICCbare can be used on balanced or unbalanced datasets with NAs.

ICCbareF is similar to ICCbare, however ICCbareF should not be used with unbalanced datasets. ICCbareF is distinguished from ICCbare, in that ICCbare is more flexible and can handle missing values and unbalanced datasets.

If the dependent variable, x, is not a factor, then the function will change it into a factor and produce a warning message.

For ICCest he confidence interval (CI) can be estimated from one of two methods included here. CIs of the type "THD" are based upon the exact confidence limit equation in Searle (1971) and can be used for unbalanced data (see Thomas and Hultquist 1978; Donner 1979). CIs of the type "Smith" are based upon the approximate formulas for the standard error of the ICC estimate (Smith 1956).

Value

a list:

ICC

the intraclass correlation coefficient

LowerCI

the lower confidence interval limit, where the confidence level is set by alpha

UpperCI

the upper confidence interval limit, where the confidence level is set by alpha

N

the total number of individuals or groups used in the analysis

k

the number of measurements per individual or group. In an unbalanced design, k is always less than the mean number of measurements per individual or group and is calculated using the equation in Lessells and Boag (1987).

varw

the within individual or group variance

vara

the among individual or group variance

Author(s)

[email protected]

References

C.M. Lessells and P.T. Boag. 1987. The Auk, 104(1):116-121.

Searle, S.R. 1971. Linear Models. New York: Wiley.

Thomas, J.D. and Hultquist, R.A. 1978. Annals of Statistics, 6:582-587.

Donner, A. 1979. American Journal of Epidemiology, 110:335-342.

Smith, C.A.B. 1956. Annals of Human Genetics, 21:363-373.

Examples

data(ChickWeight)
# ICCest
  ICCest(Chick, weight, data = ChickWeight, CI.type = "S")

Calculate the N required to estimate the ICC with a desired confidence interval

Description

Given a predicted ICC and k measures per individual/group, this function will calculate the N individuals/groups required to obtain a desired confidence interval w(Bonett 2002).

Usage

Nest(
  est.type = c("hypothetical", "pilot"),
  w,
  ICC = NULL,
  k = NULL,
  x = NULL,
  y = NULL,
  data = NULL,
  alpha = 0.05
)

Arguments

est.type

A character string of either "hypothetical" indicating usage of the given values of k and ICC or if "pilot" is specified then to calculate these from the dataset provided. Just the first letter may be used.

w

A numeric of desired width for the confidence interval about the ICC estimate.

ICC

The expected intraclass correlation coefficient.

k

The number of measurements per individual or group.

x

A column name of data indicating the individual or group ID from a pilot study.

y

A column name of data indicating the measurements from a pilot study.

data

A data.frame from a pilot experiment.

alpha

The alpha level to use when estimating the confidence interval.

Details

More than one ICC or k may be given. In this case, the return value is a dataframe with rows representing the values of the specified ICCs and the columns yield the different k values.

Value

data.frame indicating the N number of individuals or groups to use to estimate the given ICC with a desired confidence interval width. Rows represent different levels of ICC while columns indicate different levels of k measurements per individual/group.

Author(s)

[email protected]

References

D.G. Bonett. 2002. Statistics in Medicine, 21(9): 1331-1335.

M.E. Wolak, D.J. Fairbairn, Y.R. Paulsen. 2011. Methods in Ecology and Evolution, 3(1):129-137.

See Also

effort

Examples

# Example 1
  n1<-Nest("h", w = 0.14, ICC = 0.1, k = 10)
  n1
# Example 2
  data(ChickWeight)
  Nest("p", w = 0.14, x = Chick, y = weight, data = ChickWeight)
  ex2 <- ICCest(Chick, weight, ChickWeight)
  ex2$UpperCI - ex2$LowerCI #confidence interval width of pilot study
  ex2
# Example 3
  Nest("h", w = 0.14, ICC = seq(0.05, 0.15, 0.05), k = seq(10, 12, 1))