calculateIccPower: Function to calculate post-hoc power for ICC studies

Description Usage Arguments Value Author(s) References Examples

View source: R/calculateIccPower.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
##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)

Example output

[[1]]
    p  p0 k alpha tails  N     power
1 0.8 0.6 2  0.05     2 30 0.5884394

[[1]]
    p  p0 k alpha tails  N     power
1 0.8 0.6 2  0.05     2 30 0.5884394

[[2]]
    N     Power
1  30 0.5884394
2  31 0.6028997
3  32 0.6169844
4  33 0.6306944
5  34 0.6440314
6  35 0.6569979
7  36 0.6695967
8  37 0.6818316
9  38 0.6937064
10 39 0.7052259
11 40 0.7163948
12 41 0.7272186
13 42 0.7377029
14 43 0.7478535
15 44 0.7576767
16 45 0.7671787
17 46 0.7763663
18 47 0.7852461
19 48 0.7938249
20 49 0.8021096

[[1]]
    p  p0 k alpha tails  N     power
1 0.8 0.6 2  0.05     2 30 0.5884394

[[2]]
   N     Power
1 30 0.5884394
2 34 0.6384394
3 38 0.6884394
4 43 0.7384394
5 48 0.7884394
6 54 0.8384394

ICC.Sample.Size documentation built on May 2, 2019, 1:27 p.m.