This page presents 4 programs related to sample size requirements when comparing 2 proportions, and tables of these sample size.
The programs and tables on this page assumes that the difference between 2 proportions has a binomial distribution which can be converted into an approximate normal distribution, so is mainly for comparing risk difference using the Standard model.
As the risk difference (Exact model), risk ratio, and odds ratio have similar powers, the results from this page are also applicable to these models.
However, the use of odds ratio in the retrospective matched pair controlled studies is different, and sample size for these are separately calculated in sample size for matched paired control studies page
if a researcher wishes to use a smaller sample size than those produced by the programs on this page or its tables, he/she should use either the Chi Squares Test for the 2x2 contingency table or the Fisher's Exact Probability in the Compare two proportions page, as these do not assume a normal transformation of the difference between proportions. The requirements of these program are discussed in their own page
The following 4 programs are available on this page
Sample Size requires the following input
The probability of Type I Error (p, α) that will be used to determine significance. This is usually 0.05, but 0.1, 0.01, 1nd 0.001 are also used
The power (1 - β) required. Usually this is 0.8, and sometimes 0.9
The expected proportions in the two groups (P1 and P2)
The results is the sample size in each of the 2 groups, assuming that they are equal. Sample size for the 1 and 2 tail models are produced.
For example, if α of 0.05 and power of 0.8 are required, and the two proportions are expected to be 5% (0.05) and 10% (0.1), then the sample size of 343 cases per group is required for the 1 tail model, and 435 for the 2 tail model
Power requires the following imput
The probability of Type I Error (p, α) that will be used to determine significance. This is usually 0.05, but 0.1, 0.01, 1nd 0.001 are also used
The sample size and proportion found in group 1 (N1, P1) and group 2 (N2, P2)
The results are the powers of the comparison, 1 and 2 tail models.
For example, if α of 0.05 is to be used to determine statistical significance, the sample size in the two groups are (N1=76 and N2=78), and the two proportions found are 5% (P1=0.05) ans 17% (P2=0.17), then the powers of the comparison are 0.93 for the 1 tail model and 0.89 for the 2 tail model
Confidence Interval (CI) reuires the following input
The percentage representing the level of confidence reqwuired. This is usually 95%, but sometimes 99% is used
The sample size and proportion found in group 1 (N1, P1) and group 2 (N2, P2)
The results are the confidence interval of the difference, 1 and 2 tail
For example, if the sample size in the two groups are (N1=76 and N2=78), and the two proportions found are 5% (P1=0.05) ans 17% (P2=0.17), then the 95% confidence intervals are
For the 1 tail model, > -0.20 (-20%) or <-0.04 (-4%)
For the two tail model, -0.22 (-22%) to -02 (-2%)
Pilot Studies requires the following parameters
1 Tail
2 Tail
Ssiz
CI1
Diff
Dec/case
%Dec/cas
"
CI
Diff
Dec/case
%Dec/cas
5
0.999
1.1904
10
0.7064
0.2926
0.0585
6.0
0.8417
0.3487
0.0697
6.0
15
0.5768
0.1296
0.0259
4.0
0.6873
0.1545
0.0309
4.0
20
0.4995
0.0773
0.0155
3.0
0.5952
0.0921
0.0184
3.0
25
0.4468
0.0527
0.0105
2.0
0.5324
0.0628
0.0126
2.0
30
0.4078
0.0389
0.0078
2.0
0.486
0.0464
0.0093
2.0
35
0.3776
0.0303
0.0061
1.0
0.4499
0.036
0.0072
1.0
40
0.3532
0.0244
0.0049
1.0
0.4209
0.0291
0.0058
1.0
45
0.333
0.0202
0.004
1.0
0.3968
0.0241
0.0048
1.0
50
0.3159
0.0171
0.0034
1.0
0.3764
0.0204
0.0041
1.0
The % of confidence, which is usually 95 or 99%. This is converted to probability of Type I error (α)
The expected proportions in the two groups (P1 and P2)
The interval of sample size (intv) to exaamine changes in confidence interval as sample sizw=es increase. Usually this is between 3 and 10 cases
The maximum sample size per group for the estimates. In most cases, pilot studies end in 30 to 40 cases, and there is no point having a pilot study with more than 100 cases per group. A common value used is 50
The program produces a table as shown to the right, listing the confidence intervals (1 and 2 tails). With increasing sample size, the reduction in confidence interval decreases, and it can be seen that beyond 30 cases per group, the further decrease in confidence interval become trivial. A conclusion can therefore be made that a sample size of 30 cases per group would be suitable for a pilot study, to define the expected proportions, and provide information on the research environment, so that a formal comparison can be planned.
References
Machin D, Campbell M, Fayers, P, Pinol A (1997) Sample Size Tables for Clinical Studies. Second Ed. Blackwell Science IBSN 0-86542-870-0 p. 18-20
Johanson GA and Brooks GP (2010) Initial Scale Development: Sample Size for Pilot Studies. Educational and Psychological Measurement Vol.70,Iss.3;p.394-400
Sample Size Tables
This subpanel presents tables of sample size (per group) comparing two unpaired proportions, for the following combinations.
Powers ( 1 - β) of 0.8, 0.9, and 0.99
Probability of Type I Error (α) of 0.1, 0.05, 0.01, and 0.001
One and two tail models
p1 and p2 are the proportions in the two groups to be detected
Sample size calculated to be less than 1/proportion (ssiz<1/p1 or ssiz<1/p2) are not included in the table, as a single positive case in the group will then exceed the proportion being compared.
Sample size for two proportions are used mostly in the Risk Difference model, although it is also used for Risk Ratio comparisons.
Power=0.8
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.05
0.1
250
343
343
435
556
647
857
946
0.05
0.15
81
111
111
141
180
209
277
306
0.05
0.2
43
60
60
76
97
113
149
165
0.05
0.25
28
39
39
49
63
73
97
108
0.05
0.3
20
28
28
36
46
53
70
78
0.05
0.35
21
21
27
35
41
54
59
0.05
0.4
22
28
32
43
47
0.05
0.45
23
26
35
39
0.05
0.5
22
29
32
0.05
0.55
25
27
0.05
0.6
21
23
0.05
0.65
20
0.05
0.7
0.05
0.75
0.05
0.8
0.05
0.85
0.05
0.9
0.05
0.95
0.1
0.15
394
540
540
686
877
1021
1352
1493
0.1
0.2
115
157
157
199
255
297
393
434
0.1
0.25
57
79
79
100
128
149
197
218
0.1
0.3
36
49
49
62
79
92
122
135
0.1
0.35
25
34
34
43
55
64
85
94
0.1
0.4
18
25
25
32
41
48
63
70
0.1
0.45
14
20
20
25
32
37
49
54
0.1
0.5
11
16
16
20
25
30
39
44
0.1
0.55
13
13
16
21
24
32
36
0.1
0.6
11
11
14
17
20
27
30
0.1
0.65
11
15
17
23
25
0.1
0.7
10
12
15
19
21
0.1
0.75
11
12
17
18
0.1
0.8
11
14
16
0.1
0.85
12
14
0.1
0.9
11
12
0.1
0.95
10
0.15
0.2
520
714
714
906
1158
1348
1784
1971
0.15
0.25
144
197
197
250
320
373
494
545
0.15
0.3
69
95
95
121
155
180
238
263
0.15
0.35
42
57
57
73
93
109
144
159
0.15
0.4
28
39
39
49
63
74
97
108
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.15
0.45
21
28
28
36
46
54
71
78
0.15
0.5
16
22
22
27
35
41
54
60
0.15
0.55
12
17
17
22
28
32
43
47
0.15
0.6
10
14
14
17
22
26
35
38
0.15
0.65
8
11
11
14
18
21
28
31
0.15
0.7
7
9
9
12
15
18
24
26
0.15
0.75
6
8
8
10
13
15
20
22
0.15
0.8
7
7
8
11
13
17
19
0.15
0.85
6
6
7
9
11
14
16
0.15
0.9
6
8
9
12
14
0.15
0.95
7
8
10
12
0.2
0.25
628
862
862
1094
1399
1628
2155
2381
0.2
0.3
169
231
231
294
376
437
579
639
0.2
0.35
79
109
109
138
177
206
273
301
0.2
0.4
47
64
64
82
105
122
161
178
0.2
0.45
31
43
43
54
70
81
107
119
0.2
0.5
22
31
31
39
50
58
77
85
0.2
0.55
17
23
23
29
38
44
58
64
0.2
0.6
13
18
18
23
29
34
45
50
0.2
0.65
10
14
14
18
23
27
36
40
0.2
0.7
8
12
12
15
19
22
29
32
0.2
0.75
7
10
10
12
16
18
24
27
0.2
0.8
6
8
8
10
13
15
20
22
0.2
0.85
5
7
7
8
11
13
17
19
0.2
0.9
6
6
7
9
11
14
16
0.2
0.95
5
5
6
8
9
12
13
0.25
0.3
719
986
986
1251
1600
1862
2465
2722
0.25
0.35
189
259
259
329
421
490
648
716
0.25
0.4
88
120
120
152
195
227
300
332
0.25
0.45
51
70
70
89
113
132
175
193
0.25
0.5
33
46
46
58
74
87
115
127
0.25
0.55
24
32
32
41
53
61
81
90
0.25
0.6
18
24
24
31
39
46
60
67
0.25
0.65
14
19
19
24
30
35
47
52
0.25
0.7
11
15
15
19
24
28
37
41
0.25
0.75
9
12
12
15
19
22
30
33
0.25
0.8
7
10
10
12
16
18
24
27
0.25
0.85
6
8
8
10
13
15
20
22
0.25
0.9
5
7
7
8
11
12
17
18
0.25
0.95
4
5
5
7
9
10
14
15
0.3
0.35
791
1084
1084
1377
1760
2049
2712
2995
0.3
0.4
205
281
281
356
456
530
702
776
0.3
0.45
94
128
128
163
208
242
321
354
0.3
0.5
54
74
74
93
120
139
184
204
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.3
0.55
35
48
48
61
78
90
120
132
0.3
0.6
24
33
33
42
54
63
84
93
0.3
0.65
18
25
25
31
40
47
62
68
0.3
0.7
14
19
19
24
30
36
47
52
0.3
0.75
11
15
15
19
24
28
37
41
0.3
0.8
8
12
12
15
19
22
29
32
0.3
0.85
7
9
9
12
15
18
24
26
0.3
0.9
6
8
8
10
12
15
19
21
0.3
0.95
5
6
6
8
10
12
16
17
0.35
0.4
845
1159
1159
1471
1881
2189
2897
3200
0.35
0.45
216
296
296
376
481
560
741
818
0.35
0.5
98
134
134
170
217
253
335
370
0.35
0.55
55
76
76
96
123
144
190
210
0.35
0.6
36
49
49
62
79
92
122
135
0.35
0.65
25
34
34
43
55
64
85
94
0.35
0.7
18
25
25
31
40
47
62
68
0.35
0.75
14
19
19
24
30
35
47
52
0.35
0.8
10
14
14
18
23
27
36
40
0.35
0.85
8
11
11
14
18
21
28
31
0.35
0.9
7
9
9
11
15
17
23
25
0.35
0.95
5
7
7
9
12
14
18
20
0.4
0.45
881
1208
1208
1534
1961
2282
3021
3337
0.4
0.5
223
305
305
388
496
577
764
844
0.4
0.55
100
136
136
173
222
258
342
377
0.4
0.6
56
77
77
97
125
145
192
212
0.4
0.65
36
49
49
62
79
92
122
135
0.4
0.7
24
33
33
42
54
63
84
93
0.4
0.75
18
24
24
31
39
46
60
67
0.4
0.8
13
18
18
23
29
34
45
50
0.4
0.85
10
14
14
17
22
26
35
38
0.4
0.9
8
11
11
14
17
20
27
30
0.4
0.95
6
8
8
11
14
16
21
23
0.45
0.5
899
1233
1233
1565
2001
2329
3083
3405
0.45
0.55
225
309
309
392
501
583
772
852
0.45
0.6
100
136
136
173
222
258
342
377
0.45
0.65
55
76
76
96
123
144
190
210
0.45
0.7
35
48
48
61
78
90
120
132
0.45
0.75
24
32
32
41
53
61
81
90
0.45
0.8
17
23
23
29
38
44
58
64
0.45
0.85
12
17
17
22
28
32
43
47
0.45
0.9
9
13
13
16
21
24
32
36
0.45
0.95
7
10
10
12
16
19
25
27
0.5
0.55
899
1233
1233
1565
2001
2329
3083
3405
0.5
0.6
223
305
305
388
496
577
764
844
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.5
0.65
98
134
134
170
217
253
335
370
0.5
0.7
54
74
74
93
120
139
184
204
0.5
0.75
33
46
46
58
74
87
115
127
0.5
0.8
22
31
31
39
50
58
77
85
0.5
0.85
16
22
22
27
35
41
54
60
0.5
0.9
11
16
16
20
25
30
39
44
0.5
0.95
8
12
12
15
19
22
29
32
0.55
0.6
881
1208
1208
1534
1961
2282
3021
3337
0.55
0.65
216
296
296
376
481
560
741
818
0.55
0.7
94
128
128
163
208
242
321
354
0.55
0.75
51
70
70
89
113
132
175
193
0.55
0.8
31
43
43
54
70
81
107
119
0.55
0.85
21
28
28
36
46
54
71
78
0.55
0.9
14
20
20
25
32
37
49
54
0.55
0.95
10
14
14
18
23
26
35
39
0.6
0.65
845
1159
1159
1471
1881
2189
2897
3200
0.6
0.7
205
281
281
356
456
530
702
776
0.6
0.75
88
120
120
152
195
227
300
332
0.6
0.8
47
64
64
82
105
122
161
178
0.6
0.85
28
39
39
49
63
74
97
108
0.6
0.9
18
25
25
32
41
48
63
70
0.6
0.95
12
17
17
22
28
32
43
47
0.65
0.7
791
1084
1084
1377
1760
2049
2712
2995
0.65
0.75
189
259
259
329
421
490
648
716
0.65
0.8
79
109
109
138
177
206
273
301
0.65
0.85
42
57
57
73
93
109
144
159
0.65
0.9
25
34
34
43
55
64
85
94
0.65
0.95
16
21
21
27
35
41
54
59
0.7
0.75
719
986
986
1251
1600
1862
2465
2722
0.7
0.8
169
231
231
294
376
437
579
639
0.7
0.85
69
95
95
121
155
180
238
263
0.7
0.9
36
49
49
62
79
92
122
135
0.7
0.95
20
28
28
36
46
53
70
78
0.75
0.8
628
862
862
1094
1399
1628
2155
2381
0.75
0.85
144
197
197
250
320
373
494
545
0.75
0.9
57
79
79
100
128
149
197
218
0.75
0.95
28
39
39
49
63
73
97
108
0.8
0.85
520
714
714
906
1158
1348
1784
1971
0.8
0.9
115
157
157
199
255
297
393
434
0.8
0.95
43
60
60
76
97
113
149
165
0.85
0.9
394
540
540
686
877
1021
1352
1493
0.85
0.95
81
111
111
141
180
209
277
306
0.9
0.95
250
343
343
435
556
647
857
946
Power=0.9
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.05
0.1
363
474
474
582
721
824
1058
1158
0.05
0.15
117
153
153
188
232
266
342
374
0.05
0.2
63
82
82
101
125
143
183
201
0.05
0.25
41
53
53
65
81
93
119
131
0.05
0.3
29
38
38
47
58
67
86
94
0.05
0.35
22
29
29
36
44
51
66
72
0.05
0.4
23
23
28
35
40
52
57
0.05
0.45
23
29
33
42
46
0.05
0.5
24
27
35
39
0.05
0.55
20
23
30
33
0.05
0.6
25
28
0.05
0.65
22
24
0.05
0.7
20
0.05
0.75
0.05
0.8
0.05
0.85
0.05
0.9
0.05
0.95
0.1
0.15
574
748
748
918
1137
1300
1670
1827
0.1
0.2
166
217
217
266
330
377
485
531
0.1
0.25
83
109
109
133
165
189
243
266
0.1
0.3
51
67
67
82
102
117
151
165
0.1
0.35
35
46
46
57
71
81
104
114
0.1
0.4
26
34
34
42
52
60
77
85
0.1
0.45
20
26
26
33
40
46
60
66
0.1
0.5
16
21
21
26
32
37
48
52
0.1
0.55
13
17
17
21
26
30
39
43
0.1
0.6
11
14
14
17
22
25
32
35
0.1
0.65
12
12
15
18
21
27
30
0.1
0.7
10
10
12
15
18
23
25
0.1
0.75
10
13
15
20
21
0.1
0.8
11
13
17
18
0.1
0.85
11
14
16
0.1
0.9
12
13
0.1
0.95
10
11
0.15
0.2
758
988
988
1212
1502
1717
2205
2412
0.15
0.25
209
273
273
335
415
474
609
666
0.15
0.3
101
131
131
161
200
229
294
322
0.15
0.35
60
79
79
97
120
137
177
194
0.15
0.4
41
53
53
65
81
93
120
131
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.15
0.45
29
39
39
47
59
67
87
95
0.15
0.5
22
29
29
36
45
51
66
72
0.15
0.55
17
23
23
28
35
40
52
57
0.15
0.6
14
18
18
23
28
32
42
46
0.15
0.65
11
15
15
19
23
26
34
38
0.15
0.7
9
12
12
15
19
22
28
31
0.15
0.75
8
10
10
13
16
18
24
26
0.15
0.8
7
9
9
11
13
15
20
22
0.15
0.85
7
7
9
11
13
17
19
0.15
0.9
6
6
7
9
11
14
16
0.15
0.95
6
8
9
12
13
0.2
0.25
915
1193
1193
1464
1814
2074
2664
2914
0.2
0.3
245
320
320
392
486
556
714
781
0.2
0.35
115
150
150
185
229
262
336
368
0.2
0.4
68
89
89
109
135
154
198
217
0.2
0.45
45
59
59
72
90
102
132
144
0.2
0.5
32
42
42
52
64
73
94
103
0.2
0.55
24
31
31
39
48
55
71
77
0.2
0.6
19
24
24
30
37
43
55
60
0.2
0.65
15
19
19
24
30
34
44
48
0.2
0.7
12
16
16
19
24
27
35
39
0.2
0.75
10
13
13
16
20
22
29
32
0.2
0.8
8
10
10
13
16
19
24
26
0.2
0.85
7
9
9
11
13
15
20
22
0.2
0.9
5
7
7
9
11
13
17
18
0.2
0.95
6
6
7
9
11
14
15
0.25
0.3
1047
1365
1365
1674
2074
2371
3046
3332
0.25
0.35
275
358
358
440
545
623
800
876
0.25
0.4
127
166
166
203
252
288
370
405
0.25
0.45
74
96
96
118
146
167
215
235
0.25
0.5
48
63
63
77
96
110
141
154
0.25
0.55
34
44
44
54
68
77
100
109
0.25
0.6
25
33
33
40
50
57
74
81
0.25
0.65
19
25
25
31
38
44
57
62
0.25
0.7
15
20
20
24
30
35
45
49
0.25
0.75
12
16
16
19
24
28
36
39
0.25
0.8
10
13
13
16
20
22
29
32
0.25
0.85
8
10
10
13
16
18
24
26
0.25
0.9
6
8
8
10
13
15
20
21
0.25
0.95
5
7
7
8
11
12
16
18
0.3
0.35
1152
1502
1502
1842
2283
2609
3352
3666
0.3
0.4
298
388
388
477
590
675
867
949
0.3
0.45
136
177
177
217
269
308
396
433
0.3
0.5
78
101
101
124
154
177
227
248
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.3
0.55
50
66
66
81
100
114
147
161
0.3
0.6
35
46
46
56
70
80
103
112
0.3
0.65
26
33
33
41
51
59
75
83
0.3
0.7
19
25
25
31
39
44
57
63
0.3
0.75
15
20
20
24
30
35
45
49
0.3
0.8
12
16
16
19
24
27
35
39
0.3
0.85
9
12
12
15
19
22
28
31
0.3
0.9
8
10
10
12
15
18
23
25
0.3
0.95
6
8
8
10
12
14
19
20
0.35
0.4
1231
1604
1604
1969
2439
2788
3581
3917
0.35
0.45
314
410
410
503
623
712
915
1001
0.35
0.5
142
185
185
227
281
321
413
452
0.35
0.55
80
105
105
128
159
182
234
256
0.35
0.6
51
67
67
82
102
117
150
164
0.35
0.65
35
46
46
57
70
81
104
114
0.35
0.7
26
33
33
41
51
59
75
83
0.35
0.75
19
25
25
31
38
44
57
62
0.35
0.8
15
19
19
24
30
34
44
48
0.35
0.85
11
15
15
19
23
26
34
38
0.35
0.9
9
12
12
15
18
21
27
30
0.35
0.95
7
9
9
12
14
17
22
24
0.4
0.45
1283
1673
1673
2053
2543
2907
3734
4084
0.4
0.5
324
423
423
519
643
735
944
1032
0.4
0.55
144
188
188
231
287
328
421
461
0.4
0.6
81
106
106
130
161
184
237
259
0.4
0.65
51
67
67
82
102
117
150
164
0.4
0.7
35
46
46
56
70
80
103
112
0.4
0.75
25
33
33
40
50
57
74
81
0.4
0.8
19
24
24
30
37
43
55
60
0.4
0.85
14
18
18
23
28
32
42
46
0.4
0.9
11
14
14
17
22
25
32
35
0.4
0.95
8
11
11
14
17
19
25
28
0.45
0.5
1309
1707
1707
2095
2595
2966
3811
4168
0.45
0.55
327
427
427
524
649
742
953
1043
0.45
0.6
144
188
188
231
287
328
421
461
0.45
0.65
80
105
105
128
159
182
234
256
0.45
0.7
50
66
66
81
100
114
147
161
0.45
0.75
34
44
44
54
68
77
100
109
0.45
0.8
24
31
31
39
48
55
71
77
0.45
0.85
17
23
23
28
35
40
52
57
0.45
0.9
13
17
17
21
26
30
39
43
0.45
0.95
10
13
13
16
20
23
30
33
0.5
0.55
1309
1707
1707
2095
2595
2966
3811
4168
0.5
0.6
324
423
423
519
643
735
944
1032
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.5
0.65
142
185
185
227
281
321
413
452
0.5
0.7
78
101
101
124
154
177
227
248
0.5
0.75
48
63
63
77
96
110
141
154
0.5
0.8
32
42
42
52
64
73
94
103
0.5
0.85
22
29
29
36
45
51
66
72
0.5
0.9
16
21
21
26
32
37
48
52
0.5
0.95
12
15
15
19
24
27
35
39
0.55
0.6
1283
1673
1673
2053
2543
2907
3734
4084
0.55
0.65
314
410
410
503
623
712
915
1001
0.55
0.7
136
177
177
217
269
308
396
433
0.55
0.75
74
96
96
118
146
167
215
235
0.55
0.8
45
59
59
72
90
102
132
144
0.55
0.85
29
39
39
47
59
67
87
95
0.55
0.9
20
26
26
33
40
46
60
66
0.55
0.95
14
19
19
23
29
33
42
46
0.6
0.65
1231
1604
1604
1969
2439
2788
3581
3917
0.6
0.7
298
388
388
477
590
675
867
949
0.6
0.75
127
166
166
203
252
288
370
405
0.6
0.8
68
89
89
109
135
154
198
217
0.6
0.85
41
53
53
65
81
93
120
131
0.6
0.9
26
34
34
42
52
60
77
85
0.6
0.95
18
23
23
28
35
40
52
57
0.65
0.7
1152
1502
1502
1842
2283
2609
3352
3666
0.65
0.75
275
358
358
440
545
623
800
876
0.65
0.8
115
150
150
185
229
262
336
368
0.65
0.85
60
79
79
97
120
137
177
194
0.65
0.9
35
46
46
57
71
81
104
114
0.65
0.95
22
29
29
36
44
51
66
72
0.7
0.75
1047
1365
1365
1674
2074
2371
3046
3332
0.7
0.8
245
320
320
392
486
556
714
781
0.7
0.85
101
131
131
161
200
229
294
322
0.7
0.9
51
67
67
82
102
117
151
165
0.7
0.95
29
38
38
47
58
67
86
94
0.75
0.8
915
1193
1193
1464
1814
2074
2664
2914
0.75
0.85
209
273
273
335
415
474
609
666
0.75
0.9
83
109
109
133
165
189
243
266
0.75
0.95
41
53
53
65
81
93
119
131
0.8
0.85
758
988
988
1212
1502
1717
2205
2412
0.8
0.9
166
217
217
266
330
377
485
531
0.8
0.95
63
82
82
101
125
143
183
201
0.85
0.9
574
748
748
918
1137
1300
1670
1827
0.85
0.95
117
153
153
188
232
266
342
374
0.9
0.95
363
474
474
582
721
824
1058
1158
Power=0.95
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.05
0.1
473
598
598
719
872
986
1241
1348
0.05
0.15
152
193
193
231
281
318
400
435
0.05
0.2
81
103
103
124
151
170
215
233
0.05
0.25
53
67
67
80
98
111
139
152
0.05
0.3
38
48
48
58
70
79
100
109
0.05
0.35
29
36
36
44
53
60
76
83
0.05
0.4
22
29
29
34
42
48
60
66
0.05
0.45
23
23
28
34
39
49
53
0.05
0.5
23
28
32
41
44
0.05
0.55
24
27
34
37
0.05
0.6
20
23
29
31
0.05
0.65
25
27
0.05
0.7
21
23
0.05
0.75
20
0.05
0.8
0.05
0.85
0.05
0.9
0.05
0.95
0.1
0.15
747
945
945
1135
1377
1556
1958
2128
0.1
0.2
216
274
274
329
399
451
568
618
0.1
0.25
108
137
137
164
200
226
284
309
0.1
0.3
67
84
84
101
123
140
176
191
0.1
0.35
46
58
58
70
85
96
122
132
0.1
0.4
34
43
43
52
63
71
90
98
0.1
0.45
26
33
33
40
48
55
69
76
0.1
0.5
21
26
26
32
39
44
55
60
0.1
0.55
17
21
21
26
31
35
45
49
0.1
0.6
14
17
17
21
26
29
37
41
0.1
0.65
11
14
14
18
21
24
31
34
0.1
0.7
12
12
15
18
21
26
29
0.1
0.75
10
10
12
15
17
22
24
0.1
0.8
10
13
15
19
21
0.1
0.85
11
12
16
17
0.1
0.9
10
13
15
0.1
0.95
11
12
0.15
0.2
987
1248
1248
1498
1819
2055
2586
2810
0.15
0.25
272
344
344
413
502
567
714
776
0.15
0.3
131
166
166
199
242
273
344
374
0.15
0.35
78
99
99
119
145
164
207
225
0.15
0.4
53
67
67
80
98
111
140
152
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.15
0.45
38
48
48
58
71
80
101
110
0.15
0.5
29
37
37
44
54
61
77
84
0.15
0.55
22
29
29
34
42
48
60
66
0.15
0.6
18
23
23
28
34
38
48
53
0.15
0.65
14
18
18
22
27
31
39
43
0.15
0.7
12
15
15
18
23
26
33
36
0.15
0.75
10
13
13
15
19
21
27
30
0.15
0.8
8
10
10
13
16
18
23
25
0.15
0.85
7
9
9
11
13
15
19
21
0.15
0.9
7
7
9
11
12
16
17
0.15
0.95
6
6
7
9
10
13
15
0.2
0.25
1193
1507
1507
1810
2197
2482
3124
3394
0.2
0.3
319
404
404
485
589
665
837
910
0.2
0.35
150
190
190
228
277
313
394
428
0.2
0.4
88
111
111
134
163
184
232
252
0.2
0.45
58
74
74
89
108
122
154
167
0.2
0.5
41
52
52
63
77
87
110
120
0.2
0.55
31
39
39
47
58
65
82
90
0.2
0.6
24
30
30
36
44
50
64
69
0.2
0.65
19
24
24
29
35
40
51
55
0.2
0.7
15
19
19
23
28
32
41
44
0.2
0.75
12
16
16
19
23
26
33
36
0.2
0.8
10
13
13
15
19
22
27
30
0.2
0.85
8
10
10
13
16
18
23
25
0.2
0.9
7
8
8
10
13
15
19
21
0.2
0.95
5
7
7
8
11
12
16
17
0.25
0.3
1364
1724
1724
2070
2513
2838
3573
3882
0.25
0.35
358
452
452
543
660
745
938
1019
0.25
0.4
165
209
209
251
305
344
434
471
0.25
0.45
95
121
121
145
177
200
252
273
0.25
0.5
62
79
79
95
115
131
165
179
0.25
0.55
44
55
55
67
81
92
116
126
0.25
0.6
32
41
41
49
60
68
86
94
0.25
0.65
25
31
31
38
46
52
66
72
0.25
0.7
19
24
24
29
36
41
52
56
0.25
0.75
15
19
19
23
29
33
41
45
0.25
0.8
12
16
16
19
23
26
33
36
0.25
0.85
10
13
13
15
19
21
27
30
0.25
0.9
8
10
10
12
15
17
22
24
0.25
0.95
6
8
8
10
12
14
18
20
0.3
0.35
1501
1897
1897
2278
2765
3123
3931
4271
0.3
0.4
388
490
490
589
715
808
1017
1105
0.3
0.45
177
223
223
268
326
368
464
504
0.3
0.5
101
128
128
153
186
211
266
289
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.3
0.55
65
82
82
99
121
136
172
187
0.3
0.6
45
57
57
69
84
95
120
130
0.3
0.65
33
42
42
50
61
69
88
96
0.3
0.7
25
32
32
38
46
53
67
72
0.3
0.75
19
24
24
29
36
41
52
56
0.3
0.8
15
19
19
23
28
32
41
44
0.3
0.85
12
15
15
18
23
26
33
36
0.3
0.9
9
12
12
15
18
21
26
29
0.3
0.95
7
10
10
12
14
16
21
23
0.35
0.4
1604
2027
2027
2434
2954
3337
4201
4564
0.35
0.45
409
517
517
621
754
852
1073
1166
0.35
0.5
184
233
233
280
340
384
484
526
0.35
0.55
104
132
132
158
192
217
274
298
0.35
0.6
66
84
84
101
123
139
175
191
0.35
0.65
46
58
58
70
85
96
121
132
0.35
0.7
33
42
42
50
61
69
88
96
0.35
0.75
25
31
31
38
46
52
66
72
0.35
0.8
19
24
24
29
35
40
51
55
0.35
0.85
14
18
18
22
27
31
39
43
0.35
0.9
11
14
14
18
21
24
31
34
0.35
0.95
9
11
11
14
17
19
25
27
0.4
0.45
1672
2114
2114
2538
3080
3480
4380
4758
0.4
0.5
422
533
533
641
778
879
1106
1202
0.4
0.55
188
238
238
286
347
392
494
536
0.4
0.6
105
133
133
160
194
220
277
301
0.4
0.65
66
84
84
101
123
139
175
191
0.4
0.7
45
57
57
69
84
95
120
130
0.4
0.75
32
41
41
49
60
68
86
94
0.4
0.8
24
30
30
36
44
50
64
69
0.4
0.85
18
23
23
28
34
38
48
53
0.4
0.9
14
17
17
21
26
29
37
41
0.4
0.95
10
13
13
16
20
23
29
31
0.45
0.5
1707
2157
2157
2590
3143
3551
4470
4856
0.45
0.55
426
539
539
647
786
888
1118
1214
0.45
0.6
188
238
238
286
347
392
494
536
0.45
0.65
104
132
132
158
192
217
274
298
0.45
0.7
65
82
82
99
121
136
172
187
0.45
0.75
44
55
55
67
81
92
116
126
0.45
0.8
31
39
39
47
58
65
82
90
0.45
0.85
22
29
29
34
42
48
60
66
0.45
0.9
17
21
21
26
31
35
45
49
0.45
0.95
12
16
16
19
24
27
34
37
0.5
0.55
1707
2157
2157
2590
3143
3551
4470
4856
0.5
0.6
422
533
533
641
778
879
1106
1202
α
0.1
0.05
0.01
0.001
α
0.1
0.05
0.01
0.001
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
p1
p2
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
1 tail
2 tail
0.5
0.65
184
233
233
280
340
384
484
526
0.5
0.7
101
128
128
153
186
211
266
289
0.5
0.75
62
79
79
95
115
131
165
179
0.5
0.8
41
52
52
63
77
87
110
120
0.5
0.85
29
37
37
44
54
61
77
84
0.5
0.9
21
26
26
32
39
44
55
60
0.5
0.95
15
19
19
23
28
32
41
44
0.55
0.6
1672
2114
2114
2538
3080
3480
4380
4758
0.55
0.65
409
517
517
621
754
852
1073
1166
0.55
0.7
177
223
223
268
326
368
464
504
0.55
0.75
95
121
121
145
177
200
252
273
0.55
0.8
58
74
74
89
108
122
154
167
0.55
0.85
38
48
48
58
71
80
101
110
0.55
0.9
26
33
33
40
48
55
69
76
0.55
0.95
18
23
23
28
34
39
49
53
0.6
0.65
1604
2027
2027
2434
2954
3337
4201
4564
0.6
0.7
388
490
490
589
715
808
1017
1105
0.6
0.75
165
209
209
251
305
344
434
471
0.6
0.8
88
111
111
134
163
184
232
252
0.6
0.85
53
67
67
80
98
111
140
152
0.6
0.9
34
43
43
52
63
71
90
98
0.6
0.95
22
29
29
34
42
48
60
66
0.65
0.7
1501
1897
1897
2278
2765
3123
3931
4271
0.65
0.75
358
452
452
543
660
745
938
1019
0.65
0.8
150
190
190
228
277
313
394
428
0.65
0.85
78
99
99
119
145
164
207
225
0.65
0.9
46
58
58
70
85
96
122
132
0.65
0.95
29
36
36
44
53
60
76
83
0.7
0.75
1364
1724
1724
2070
2513
2838
3573
3882
0.7
0.8
319
404
404
485
589
665
837
910
0.7
0.85
131
166
166
199
242
273
344
374
0.7
0.9
67
84
84
101
123
140
176
191
0.7
0.95
38
48
48
58
70
79
100
109
0.75
0.8
1193
1507
1507
1810
2197
2482
3124
3394
0.75
0.85
272
344
344
413
502
567
714
776
0.75
0.9
108
137
137
164
200
226
284
309
0.75
0.95
53
67
67
80
98
111
139
152
0.8
0.85
987
1248
1248
1498
1819
2055
2586
2810
0.8
0.9
216
274
274
329
399
451
568
618
0.8
0.95
81
103
103
124
151
170
215
233
0.85
0.9
747
945
945
1135
1377
1556
1958
2128
0.85
0.95
152
193
193
231
281
318
400
435
0.9
0.95
473
598
598
719
872
986
1241
1348
Javascript Program
Input Data
Data Input for Sample Size Estimation: Table in 4 columns
- Each row contains data from a separate study
- Col 1 = probability of Type I error (alpha)
- Col 2 = power (1-beta)
- Col 3, 4 = proportion expected in grp 1 & 2
Data Input for Power Estimation Table in 5 columns
- Each row contains data from a separate study
- Col 1 = probability of Type I error (alpha)
- Col 2, 4 = sample size in group 1 & 2
- Col 3, 5 = proportion found in group 1 & 2
Data Input for Confidence Interval Study Table in 5 columns
- Each row contains data from a separate study
- Col 1 = percent confidence (usually 95)
- Col 2, 4 = sample size in group 1 & 2
- Col 3, 5 = proportion found in group 1 & 2
Data Input for Pilot Study is for a single plan. Single column, 5 rows
- Row 1 : Percent Confidence required, usually 95 or 99
- Row 2, 3 : Planned Proportion in Group 1 & 2
- Row 4 : Sample Size (per group) Interval, usually 5
- Row 5 : Maximum Sample size (per group), usually 50
R Codes
Sample Size
# Sample Size
# data entry
dat = ("
Alpha Power P1 P2
0.05 0.8 0.05 0.1
0.01 0.8 0.05 0.1
0.05 0.9 0.05 0.1
0.01 0.9 0.05 0.1
")
df <- read.table(textConnection(dat),header=TRUE) # conversion to data frame
# vectors for results
SSiz1Tail <- vector()
SSiz2Tail <- vector()
# Calculate sample size
for(i in 1 : nrow(df))
{
alpha = df$Alpha[i]
beta = 1 - df$Power[i]
p1 = df$P1[i]
p2 = df$P2[i]
ra = 1
pm = (p1 + ra * p2) / (1 + ra) # mean prop
delta = abs(p1 - p2)
zb = qnorm(beta)
za = qnorm(alpha / 1) # 1 tail za
top = za * sqrt((1 + ra) * pm * (1 - pm)) + zb * sqrt(ra * p1 * (1 - p1) + p2 * (1 - p2))
SSiz1Tail <- append(SSiz1Tail, ceiling(top^2 / (ra * delta^2)))
za = qnorm(alpha / 2) # 2 tail za
top = za * sqrt((1 + ra) * pm * (1 - pm)) + zb * sqrt(ra * p1 * (1 - p1) + p2 * (1 - p2))
SSiz2Tail <- append(SSiz2Tail, ceiling(top^2 / (ra * delta^2)))
}
df$SSiz1Tail <- SSiz1Tail
df$SSiz2Tail <- SSiz2Tail
df # input data and sample size per group
The results are sample size per group for 1 and 2 tail models
> df # input data and sample size per group
Alpha Power P1 P2 SSiz1Tail SSiz2Tail
1 0.05 0.8 0.05 0.1 343 435
2 0.01 0.8 0.05 0.1 556 647
3 0.05 0.9 0.05 0.1 474 582
4 0.01 0.9 0.05 0.1 721 824
Power
# Power
# data entry
dat = ("
Alpha N1 P1 N2 P2
0.05 76 0.05 78 0.17
0.01 113 0.05 115 0.22
0.05 101 0.05 100 0.21
0.01 143 0.05 140 0.19
")
df <- read.table(textConnection(dat),header=TRUE) # conversion to data frame
df
# Vectors for results
Power1Tail <- vector()
Power2Tail <- vector()
# Calculations
for(i in 1 : nrow(df))
{
alpha = df$Alpha[i]
n1 = df$N1[i]
p1 = df$P1[i]
n2 = df$N2[i]
p2 = df$P2[i]
ra = n2 / n1
pm = (p1 + ra * p2) / (1 + ra) # mean prop
delta = abs(p1 - p2)
za = abs(qnorm(alpha / 1)) # 1 tail
zb = (delta * sqrt(ra * n1) - za * sqrt((1 + ra) * pm * (1 - pm))) / sqrt(ra * p1 * (1 - p1) + p2 * (1 - p2))
Power1Tail <- append(Power1Tail,pnorm(zb))
za = abs(qnorm(alpha / 2)) # 2 tail
zb = (delta * sqrt(ra * n1) - za * sqrt((1 + ra) * pm * (1 - pm))) / sqrt(ra * p1 * (1 - p1) + p2 * (1 - p2))
Power2Tail <- append(Power2Tail,pnorm(zb))
}
# include results to data frame for display
df$Power1Tail <- Power1Tail
df$Power2Tail <- Power2Tail
df # dataframw with data entry and results (power 1 and 2 tail)