| Title: | Calculation of Sample Size and Power for ICC |
|---|---|
| Description: | Provides functions to calculate the requisite sample size for studies where ICC is the primary outcome. Can also be used for calculation of power. In both cases it allows the user to test the impact of changing input variables by calculating the outcome for several different values of input variables. Based off the work of Zou. Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981. |
| Authors: | Alasdair Rathbone [aut, cre], Saurabh Shaw [aut], Dinesh Kumbhare [aut] |
| Maintainer: | Alasdair Rathbone <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1 |
| Built: | 2026-05-31 09:14:18 UTC |
| Source: | https://github.com/cran/ICC.Sample.Size |
Provides functions to calculate the requisite sample size for studies where ICC is the primary outcome. Can also be used for calculation of power. In both cases it allows the user to test the impact of changing input variables by calculating the outcome for several different values of input variables. Based off the work of Zou. Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981.
| Package: | ICC.Sample.Size |
| Type: | Package |
| Version: | 1.0 |
| Date: | 2015-08-01 |
| License: | GPL-3 |
This package provides a sample size and power calculator for ICC based off those derived by Zou (Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981.) It contains the following functions:
calculateIccSampleSize:
Calculates a sample size for given values of p, the null hypothesis p0, number of raters (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.
ICC.power:
Calculates power for given value of p, the null hypothesis p0, number of raters (k), number of comparisons (N) and alpha. Can also be used to calculate the effect of increasing N at given intervals to a maximum N, or to calculate the increase in sample size to obtain increasing power with a given maximum N.
ICC.achievable.p0:
Calculates the largest possible null hypothesis that can be tests with given power and alpha for p, the null hypothesis p0, number of raters (k) and number of comparisons (N)
Alasdair Rathbone, Saurabh Shaw, Dinesh Kumbhare
Maintainer: Alasdair Rathbone <[email protected]>
Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981.
This function when given the parameters of a study to measure an ICC calculates what is the largest p0 that can be tested for at the specified power, alpha and number of tails.
calculateAchievablep0(p,k,alpha,tails,power,N)calculateAchievablep0(p,k,alpha,tails,power,N)
p |
The intraclass correlation coefficient obtained in the study. No default. |
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 tails for the hypothesis test. If missing default is 2. |
power |
The desired power of the hypothesis test. If missing default is 0.80. |
N |
The number of subjects in the study. No default |
Returns a list with the following items:
resultFrame |
A data frame consisting of columns p0,N,p,k,alpha,tails and power. |
Alasdair Rathbone, Saurabh Shaw, Dinesh Kumbhare
Maintainer: Alasdair Rathbone <[email protected]>
Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981.
##Calculate achieveable p0 for a given study with p=0.80,k=2,alpha=0.05,tails=2,power=0.80,N=30 calculateAchievablep0(p=0.80,k=2,alpha=0.05,tails=2,power=0.80,N=30)##Calculate achieveable p0 for a given study with p=0.80,k=2,alpha=0.05,tails=2,power=0.80,N=30 calculateAchievablep0(p=0.80,k=2,alpha=0.05,tails=2,power=0.80,N=30)
Calculates a post-hoc power for an ICC study. Given the study parameters can also demonstrate the additional power gained by increasing number of subjects or the number of subjects needed to be added to increase power.
calculateIccPower(p,p0,k,alpha,tails,N,by,desiredPower,maxN,step)calculateIccPower(p,p0,k,alpha,tails,N,by,desiredPower,maxN,step)
p |
The intraclass correlation coefficient obtained in the study. No default. |
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 tails for the hypothesis test. If missing default is 2. |
N |
The number of subjects in the study. No default |
by |
Can be used to calculate sample sizes for varied p and/or p0. If If If If missing, default is |
desiredPower |
The desired power of the study. If calculated desired power is reached then function will cease to increase N or power by steps and return result. If missing default is 0.80. |
maxN |
The maximum N to increase sample size to when testing the effect on increasing sample size on power or the requisite increase in sample size for increasing power. If maxN is reached then function will cease to increase N or power by steps and return result. If missing default is 10 times the N of the study. |
step |
When the function varies N or power it calculates power or sample size respectively for N or power, then for 0+ |
Returns a list with the following items:
parameters |
Dataframe with columns p,p0,k,alpha,tails,N,power. |
NPower |
Dataframe with a list of N's and powers calculated. Provided when by="N" or by"power". |
Alasdair Rathbone, Saurabh Shaw, Dinesh Kumbhare
Maintainer: Alasdair Rathbone <[email protected]>
Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981.
##Calculate post-hoc power for p=0.80, p0=0.60, k=2, alpha=0.05, tails=2 and N of 30. calculateIccPower(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,N=30) ##Calculate post-hoc power for p=0.80, p0=0.60, k=2, alpha=0.05, tails=2 and N of 30. ##Test effect on power of increasing sample size in steps of 1 up until a maximum of 50 ##with a desired power of 0.80. calculateIccPower(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,N=30, by="N",desiredPower=0.80,maxN=50) ##alculate post-hoc power for p=0.80, p0=0.60, k=2, alpha=0.05, tails=2 and N of 30. ##Calculate the sample size need to increase power by ##steps of 0.05 up until a maximum sample size of 50 with a desired power of 0.80. calculateIccPower(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,N=30, by="power",desiredPower=0.80,maxN=50)##Calculate post-hoc power for p=0.80, p0=0.60, k=2, alpha=0.05, tails=2 and N of 30. calculateIccPower(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,N=30) ##Calculate post-hoc power for p=0.80, p0=0.60, k=2, alpha=0.05, tails=2 and N of 30. ##Test effect on power of increasing sample size in steps of 1 up until a maximum of 50 ##with a desired power of 0.80. calculateIccPower(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,N=30, by="N",desiredPower=0.80,maxN=50) ##alculate post-hoc power for p=0.80, p0=0.60, k=2, alpha=0.05, tails=2 and N of 30. ##Calculate the sample size need to increase power by ##steps of 0.05 up until a maximum sample size of 50 with a desired power of 0.80. calculateIccPower(p=0.80,p0=0.60,k=2,alpha=0.05,tails=2,N=30, by="power",desiredPower=0.80,maxN=50)
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.
calculateIccSampleSize(p,p0,k,alpha,tails,power,by,step)calculateIccSampleSize(p,p0,k,alpha,tails,power,by,step)
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 tails for the 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+ |
Returns a list with the following items:
resultdf |
Data frame with columns N, p, p0, k, alpha, tails, and power. |
sampleSize |
For |
nDataframe |
For |
Alasdair Rathbone, Saurabh Shaw, Dinesh Kumbhare
Maintainer: Alasdair Rathbone <[email protected]>
Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981.
## 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)## 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)