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 |
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.
Maintainer: Matthew Wolak [email protected]
Useful links:
k
Measures Based Upon a Fixed Total Researcher EffortGiven 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
.
effort( est.type = c("hypothetical", "pilot"), e = NULL, ICC = NULL, x = NULL, y = NULL, data = NULL, alpha = 0.05 )
effort( est.type = c("hypothetical", "pilot"), e = NULL, ICC = NULL, x = NULL, y = NULL, data = NULL, alpha = 0.05 )
est.type |
A character string of either |
e |
A numeric value indicating the total effort ( |
ICC |
A numeric value of the expected intraclass correlation coefficient. |
x |
Column name of |
y |
Column name of |
data |
A |
alpha |
A numeric indicating the alpha level to use when estimating the confidence interval. |
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.
#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)
#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)
Estimates the ICC and confidence intervals using the variance components from a one-way ANOVA.
ICCbare(x, y, data = NULL) ICCbareF(x, y, data = NULL) ICCest(x, y, data = NULL, alpha = 0.05, CI.type = c("THD", "Smith"))
ICCbare(x, y, data = NULL) ICCbareF(x, y, data = NULL) ICCest(x, y, data = NULL, alpha = 0.05, CI.type = c("THD", "Smith"))
x |
A column name indicating individual or group id in the dataframe
|
y |
A column name indicating measurements in the dataframe |
data |
A data.frame containing |
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. |
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).
a list
:
the intraclass correlation coefficient
the lower confidence interval limit, where the confidence
level is set by alpha
the upper confidence interval limit, where the confidence
level is set by alpha
the total number of individuals or groups used in the analysis
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).
the within individual or group variance
the among individual or group variance
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.
data(ChickWeight) # ICCest ICCest(Chick, weight, data = ChickWeight, CI.type = "S")
data(ChickWeight) # ICCest ICCest(Chick, weight, data = ChickWeight, CI.type = "S")
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).
Nest( est.type = c("hypothetical", "pilot"), w, ICC = NULL, k = NULL, x = NULL, y = NULL, data = NULL, alpha = 0.05 )
Nest( est.type = c("hypothetical", "pilot"), w, ICC = NULL, k = NULL, x = NULL, y = NULL, data = NULL, alpha = 0.05 )
est.type |
A character string of either |
w |
A |
ICC |
The expected intraclass correlation coefficient. |
k |
The number of measurements per individual or group. |
x |
A column name of |
y |
A column name of |
data |
A |
alpha |
The alpha level to use when estimating the confidence interval. |
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.
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.
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.
# 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))
# 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))