Type: Package
Version: 1.0
Date: 2015-08-01
Title: Calculation of Sample Size and Power for ICC
Author: Alasdair Rathbone [aut,cre], Saurabh Shaw [aut], Dinesh Kumbhare [aut]
Maintainer: Alasdair Rathbone <alasdair.rathbone@gmail.com>
Imports: stats
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.
License: GPL-3
Packaged: 2015-09-02 12:48:14 UTC; alasdairrathbone
NeedsCompilation: no
Repository: CRAN
Date/Publication: 2015-09-04 01:03:54

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.

Details

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)

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.


Function to calculate largest p0 that the data are powered to test

Description

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.

Usage

calculateAchievablep0(p,k,alpha,tails,power,N)

Arguments

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 trails for 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

Value

Returns a list with the following items:

resultFrame

A data frame consisting of columns p0,N,p,k,alpha,tails and power.

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

Function to calculate post-hoc power for ICC studies

Description

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.

Usage

calculateIccPower(p,p0,k,alpha,tails,N,by,desiredPower,maxN,step)

Arguments

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 trails for 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 by="" Only the post-hoc power will be calculated.

If by="N" Increases N by step and calculates new power for each larger N until either maximum N or desired power is reached.

If by="power" Increase power by step and calculates requisite sample size for each larger power until either maximum N or desired power is reached.

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+step*(i-1) where i is the number of repeats, until MaxN or desired power is reached.

Value

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".

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

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 by="" Only the sample size for the specified p and p0 will be calculated.

If by="p" Calculates sample sizes for all p starting from 0, increasing by step until 1.

If by="p0" Calculates sample sizes for all p0 starting from 0, increasing by step until 1.

If by="both" Calculates sample sizes for all combinations of p and p0 starting each from 0, increasing by step until 1. Row labels are p and column labels are p0.

If missing, default is "".

step

When the function varies p or p0 it calculates sample size for 0, then for 0+step*(i-1) where i is the number of repeats, until p=1

Value

Returns a list with the following items:

resultdf

Data frame with columns N, p, p0, k, alpha, tails, and power.

sampleSize

For by="p" or by="p0" is a data frame with columns of p or p0 respectively and N.

nDataframe

For by="both" is a data frame with rows defined by p and columns defined by p0 representing values of N for each combination.

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)