Description Usage Arguments Value Author(s) References Examples
View source: R/calculateIccSampleSize.R
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.
1 | 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 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+ |
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 <alasdair.rathbone@gmail.com>
Zou, G. Y. (2012). Sample size formulas for estimating intraclass correlation coefficients with precision and assurance. Statistics in medicine, 31(29), 3972-3981.
1 2 3 4 5 6 7 8 | ## 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)
|
[[1]]
N p p0 k alpha tails power
1 49 0.8 0.6 2 0.05 2 0.8
[[1]]
N p p0 k alpha tails power
1 49 0.8 0.6 2 0.05 2 0.8
[[2]]
p N
1 0.00 18
2 0.05 20
3 0.10 24
4 0.15 28
5 0.20 34
6 0.25 42
7 0.30 55
8 0.35 75
9 0.40 110
10 0.45 182
11 0.50 381
12 0.55 1406
13 0.60 Inf
14 0.65 1164
15 0.70 260
16 0.75 102
17 0.80 49
18 0.85 26
19 0.90 14
20 0.95 8
[[1]]
N p p0 k alpha tails power
1 49 0.8 0.6 2 0.05 2 0.8
[[2]]
p0 N
1 0.00 8.000000e+00
2 0.05 9.000000e+00
3 0.10 9.000000e+00
4 0.15 1.000000e+01
5 0.20 1.100000e+01
6 0.25 1.300000e+01
7 0.30 1.400000e+01
8 0.35 1.600000e+01
9 0.40 1.900000e+01
10 0.45 2.200000e+01
11 0.50 2.800000e+01
12 0.55 3.600000e+01
13 0.60 4.900000e+01
14 0.65 7.700000e+01
15 0.70 1.480000e+02
16 0.75 4.990000e+02
17 0.80 5.198178e+31
18 0.85 3.180000e+02
19 0.90 5.800000e+01
20 0.95 1.600000e+01
[[1]]
N p p0 k alpha tails power
1 49 0.8 0.6 2 0.05 2 0.8
[[2]]
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7
0 Inf 3136 781 345 192 122 83 60 45 35 28 22 18 15 12
0.05 3136 Inf 3105 769 338 188 118 80 58 43 33 26 20 16 13
0.1 781 3105 Inf 3042 750 328 181 113 77 55 40 31 24 19 15
0.15 345 769 3042 Inf 2950 723 314 172 107 72 51 37 28 22 17
0.2 192 338 750 2950 Inf 2830 690 298 162 100 67 47 34 25 19
0.25 122 188 328 723 2830 Inf 2683 650 279 151 92 61 42 31 22
0.3 83 118 181 314 690 2683 Inf 2511 604 257 138 84 55 38 27
0.35 60 80 113 172 298 650 2511 Inf 2318 553 234 124 75 48 33
0.4 45 58 77 107 162 279 604 2318 Inf 2107 499 208 110 65 41
0.45 35 43 55 72 100 151 257 553 2107 Inf 1882 441 182 94 55
0.5 28 33 40 51 67 92 138 234 499 1882 Inf 1646 381 155 79
0.55 22 26 31 37 47 61 84 124 208 441 1646 Inf 1406 320 128
0.6 18 20 24 28 34 42 55 75 110 182 381 1406 Inf 1164 260
0.65 15 16 19 22 25 31 38 48 65 94 155 320 1164 Inf 929
0.7 12 13 15 17 19 22 27 33 41 55 79 128 260 929 Inf
0.75 10 11 12 13 15 17 19 23 28 34 45 64 102 202 705
0.8 8 9 9 10 11 13 14 16 19 22 28 36 49 77 148
0.85 6 7 7 8 9 9 10 11 13 15 17 21 26 35 53
0.9 5 5 6 6 6 7 7 8 9 10 11 12 14 18 23
0.95 4 4 4 4 4 5 5 5 5 6 6 7 8 9 10
0.75 0.8 0.85 0.9 0.95
0 10 8 6 5 4
0.05 11 9 7 5 4
0.1 12 9 7 6 4
0.15 13 10 8 6 4
0.2 15 11 9 6 4
0.25 17 13 9 7 5
0.3 19 14 10 7 5
0.35 23 16 11 8 5
0.4 28 19 13 9 5
0.45 34 22 15 10 6
0.5 45 28 17 11 6
0.55 64 36 21 12 7
0.6 102 49 26 14 8
0.65 202 77 35 18 9
0.7 705 148 53 23 10
0.75 Inf 499 99 33 12
0.8 499 Inf 318 58 16
0.85 99 318 Inf 170 25
0.9 33 58 170 Inf 62
0.95 12 16 25 62 Inf
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.