calculateIccSampleSize {ICC.Sample.Size} | R Documentation |
Function to calculate sample size required for studies where ICC is primary outcome.
Description
Calculates a sample size for given values of p, the null hypothesis p0, number of ratings (k), desired power and alpha. Can also generate sample sizes for different values of p, p0 or combinations of p and p0 from 0-1.
Usage
calculateIccSampleSize(p,p0,k,alpha,tails,power,by,step)
Arguments
p |
The hypothesized value of p. Hypothesized based on previous data, or experience. If missing default is 0. |
p0 |
The null hypothesis value of p. If missing default is 0. |
k |
The number of ratings of each subject. If missing default is 2. |
alpha |
The desired alpha for hypothesis testing. If missing default is 0.05. |
tails |
The number of trails for hypothesis test. If missing default is 2. |
power |
The desired power of the hypothesis test. If missing default is 0.80. |
by |
Can be used to calculate sample sizes for varied p and/or p0. If If If If If missing, default is |
step |
When the function varies p or p0 it calculates sample size for 0, then for 0+ |
Value
Returns a list with the following items:
resultdf |
Data frame with columns N, p, p0, k, alpha, tails, and power. |
sampleSize |
For |
nDataframe |
For |
Author(s)
Alasdair Rathbone, Saurabh Shaw, Dinesh Kumbhare
Maintainer: Alasdair Rathbone <alasdair.rathbone@gmail.com>
References
Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981.
Examples
## Calculate Sample Size for p=0.80, p0=0.60, two ratings, alpha=0.05 with two tails and power=0.80.
calculateIccSampleSize(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,power=0.80)
## Calculate Sample Size as above, but test varying p from 0 to 1 by steps of 0.05
calculateIccSampleSize(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,power=0.80,by="p",step=0.05)
## Calculate Sample Size as above, but test varying p0 from 0 to 1 by steps of 0.05
calculateIccSampleSize(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,power=0.80,by="p0",step=0.05)
## Calculate Sample Size as above, but test varying both p and p0 from 0 to 1 by steps of 0.05
calculateIccSampleSize(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,power=0.80,by="both",step=0.05)