Last data update: 2014.03.03

R: Calculate the N individuals/groups required to estimate the...
NestR Documentation

Calculate the N individuals/groups 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(according to 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

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

desired width of the confidence interval about the ICC estimate

ICC

expected intraclass correlation coefficient

k

number of measurements per individual or group

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

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)

Matthew Wolak matthewwolak@gmail.com

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.

See Also

ICCest

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))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ICC)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ICC/Nest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Nest
> ### Title: Calculate the N individuals/groups required to estimate the ICC
> ###   with a desired confidence interval
> ### Aliases: Nest
> 
> ### ** Examples
> 
> #Example 1
>   n1<-Nest("h", w = 0.14, ICC = 0.1, k = 10)
>   n1
    10
0.1 52
> 
> #Example 2
>   data(ChickWeight)
>   Nest("p", w = 0.14, x = Chick, y = weight, data = ChickWeight)
[1] 48
>   ex2 <- ICCest(Chick, weight, ChickWeight)
>   ex2$UpperCI - ex2$LowerCI #confidence interval width of pilot study
[1] 0.1414002
>   ex2
$ICC
[1] 0.1077609

$LowerCI
[1] 0.05215607

$UpperCI
[1] 0.1935563

$N
[1] 50

$k
[1] 11.55519

$varw
[1] 4516.005

$vara
[1] 545.4238

> 
> #Example 3
>   Nest("h", w = 0.14, ICC = seq(0.05, 0.15, 0.05), k = seq(10, 12, 1))
     10 11 12
0.05 35 30 27
0.1  52 48 44
0.15 71 66 62
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>