options linesize = 80 ; footnote "~john-c/5421/samptwo.sas &sysdate &systime" ; /* Program to compute sample size for two groups ... unpaired, dichotomous outcome. The printed sample sizes are for ONE of the two groups. Failure proportions resp. p1 and p2 for the two groups. Sample sizes for various powers, both with and without a continuity correction ... Reference: J. L. Fleiss, Statistical Methods for Rates and Proportions, 2nd Edition, John Wiley and Sons, New York. */ options linesize = 120 ; /* Input two-sided alpha level here ... */ %let alph = .050 ; DATA SIGDELT ; INPUT p2 p1 ; /* Enter PERCENT failure rates, not proportions, in the CARDS section */ p2 = p2 / 100 ; p1 = p1 / 100 ; q2 = 1 - p2 ; q1 = 1 - p1 ; delta = abs(p2 - p1) ; pbar = .5*(p1 + p2) ; qbar = 1 - pbar ; sigma = sqrt(pbar*(1 - pbar)) ; CARDS ; 14 28 20 28 15 30 20 30 25.0 50.0 53.0 35.0 30.0 15.0 20.0 5.0 17.5 5.0 15.0 5.0 50.0 35.0 50.0 40.0 55.0 44.0 55.0 41.3 58.0 43.5 58.0 46.4 60.0 45.0 60.0 48.0 64.0 48.0 64.0 51.2 ; DATA SAMPSIZE ; SET SIGDELT ; ALPHA = &alph ; POWER1 = .80 ; POWER2 = .85 ; POWER3 = .90 ; POWER4 = .95 ; POWER5 = .99 ; ZALPHA2 = PROBIT(1 - ALPHA/2) ; ZBETA1 = PROBIT(POWER1) ; ZBETA2 = PROBIT(POWER2) ; ZBETA3 = PROBIT(POWER3) ; ZBETA4 = PROBIT(POWER4) ; ZBETA5 = PROBIT(POWER5) ; top1 = (zalpha2*sqrt(2*pbar*qbar) + zbeta1*sqrt(p1*q1 + p2*q2))**2 ; top2 = (zalpha2*sqrt(2*pbar*qbar) + zbeta2*sqrt(p1*q1 + p2*q2))**2 ; top3 = (zalpha2*sqrt(2*pbar*qbar) + zbeta3*sqrt(p1*q1 + p2*q2))**2 ; top4 = (zalpha2*sqrt(2*pbar*qbar) + zbeta4*sqrt(p1*q1 + p2*q2))**2 ; top5 = (zalpha2*sqrt(2*pbar*qbar) + zbeta5*sqrt(p1*q1 + p2*q2))**2 ; bottom = (p2 - p1)**2 ; N1 = top1 / bottom ; N2 = top2 / bottom ; N3 = top3 / bottom ; N4 = top4 / bottom ; N5 = top5 / bottom ; /* Continuity correction ... */ f1 = 1 + sqrt(1 + 4 / (n1 * abs(p2 - p1))) ; f2 = 1 + sqrt(1 + 4 / (n2 * abs(p2 - p1))) ; f3 = 1 + sqrt(1 + 4 / (n3 * abs(p2 - p1))) ; f4 = 1 + sqrt(1 + 4 / (n4 * abs(p2 - p1))) ; f5 = 1 + sqrt(1 + 4 / (n5 * abs(p2 - p1))) ; ccn1 = .25 * n1 * f1 * f1 ; ccn2 = .25 * n2 * f2 * f2 ; ccn3 = .25 * n3 * f3 * f3 ; ccn4 = .25 * n4 * f4 * f4 ; ccn5 = .25 * n5 * f5 * f5 ; run ; FOOTNOTE "program samptwo.sas (jec) &sysdate &systime" ; PROC PRINT DATA = SAMPSIZE ; VAR ALPHA P1 P2 SIGMA DELTA POWER1 N1 POWER2 N2 POWER3 N3 POWER4 N4 POWER5 N5 ; format alpha 6.3 p1 p2 6.3 sigma delta 7.3 power1 power2 power3 power4 power5 6.3 n1 n2 n3 n4 n5 5.0 ; TITLE1 "Sample sizes for 2-sided alpha = &alph, various powers..." ; title2 'Two-group study, dichotomous outcome.' ; title3 'Numbers are sample size for EACH of the two groups' ; title4 'Page 1: No continuity correction ...' ; title5 'Reference: J. Fleiss, Statistical Methods for Rates and Proportions,' ; title6 '2nd Edition. John Wiley & Sons, New York.' ; run ; PROC PRINT DATA = SAMPSIZE ; VAR ALPHA P1 P2 SIGMA DELTA POWER1 CCN1 POWER2 CCN2 POWER3 CCN3 POWER4 CCN4 POWER5 CCN5 ; format alpha 6.3 p1 p2 6.3 sigma delta 7.3 power1 power2 power3 power4 power5 6.3 ccn1 ccn2 ccn3 ccn4 ccn5 5.0 ; TITLE1 "Sample sizes for 2-sided alpha = &alph, various powers..." ; title2 'Two-group study, dichotomous outcome.' ; title3 'Numbers are sample size for EACH of the two groups' ; title4 'Page 2: Continuity-Corrected.' ; title5 'Reference: J. Fleiss, Statistical Methods for Rates and Proportions,' ; title6 '2nd Edition. John Wiley & Sons, New York.' ; run ; ------------------------------------------------------------------------------------------------------------------------ Sample sizes for 2-sided alpha = .050, various powers... 1 Two-group study, dichotomous outcome. 18:25 Wednesday, May 4, 2005 Numbers are sample size for EACH of the two groups Page 1: No continuity correction ... Reference: J. Fleiss, Statistical Methods for Rates and Proportions, 2nd Edition. John Wiley & Sons, New York. OBS ALPHA P1 P2 SIGMA DELTA POWER1 N1 POWER2 N2 POWER3 N3 POWER4 N4 POWER5 N5 1 0.050 0.500 0.250 0.484 0.250 0.800 58 0.850 66 0.900 77 0.950 94 0.990 133 2 0.050 0.350 0.530 0.496 0.180 0.800 118 0.850 135 0.900 158 0.950 195 0.990 274 3 0.050 0.150 0.300 0.418 0.150 0.800 120 0.850 138 0.900 161 0.950 198 0.990 280 4 0.050 0.050 0.200 0.331 0.150 0.800 75 0.850 86 0.900 100 0.950 123 0.990 174 5 0.050 0.050 0.175 0.316 0.125 0.800 99 0.850 113 0.900 132 0.950 163 0.990 230 6 0.050 0.050 0.150 0.300 0.100 0.800 140 0.850 160 0.900 187 0.950 231 0.990 326 7 0.050 0.350 0.500 0.494 0.150 0.800 169 0.850 193 0.900 226 0.950 279 0.990 394 8 0.050 0.400 0.500 0.497 0.100 0.800 387 0.850 443 0.900 518 0.950 640 0.990 904 9 0.050 0.440 0.550 0.500 0.110 0.800 323 0.850 369 0.900 432 0.950 534 0.990 754 10 0.050 0.413 0.550 0.500 0.137 0.800 208 0.850 237 0.900 277 0.950 343 0.990 484 11 0.050 0.435 0.580 0.500 0.145 0.800 185 0.850 212 0.900 248 0.950 306 0.990 432 12 0.050 0.464 0.580 0.500 0.116 0.800 290 0.850 331 0.900 388 0.950 479 0.990 676 13 0.050 0.450 0.600 0.499 0.150 0.800 173 0.850 197 0.900 231 0.950 285 0.990 402 14 0.050 0.480 0.600 0.498 0.120 0.800 270 0.850 308 0.900 360 0.950 445 0.990 629 15 0.050 0.480 0.640 0.496 0.160 0.800 150 0.850 171 0.900 200 0.950 247 0.990 349 16 0.050 0.512 0.640 0.494 0.128 0.800 233 0.850 266 0.900 311 0.950 384 0.990 543 program samptwo.sas (jec) 04MAY05 18:25 ------------------------------------------------------------------------------------------------------------------------ Sample sizes for 2-sided alpha = .050, various powers... 2 Two-group study, dichotomous outcome. 18:25 Wednesday, May 4, 2005 Numbers are sample size for EACH of the two groups Page 2: Continuity-Corrected. Reference: J. Fleiss, Statistical Methods for Rates and Proportions, 2nd Edition. John Wiley & Sons, New York. OBS ALPHA P1 P2 SIGMA DELTA POWER1 CCN1 POWER2 CCN2 POWER3 CCN3 POWER4 CCN4 POWER5 CCN5 1 0.050 0.500 0.250 0.484 0.250 0.800 65 0.850 74 0.900 85 0.950 102 0.990 141 2 0.050 0.350 0.530 0.496 0.180 0.800 129 0.850 146 0.900 169 0.950 206 0.990 285 3 0.050 0.150 0.300 0.418 0.150 0.800 133 0.850 151 0.900 174 0.950 212 0.990 293 4 0.050 0.050 0.200 0.331 0.150 0.800 88 0.850 99 0.900 113 0.950 136 0.990 187 5 0.050 0.050 0.175 0.316 0.125 0.800 115 0.850 129 0.900 148 0.950 179 0.990 246 6 0.050 0.050 0.150 0.300 0.100 0.800 159 0.850 179 0.900 207 0.950 251 0.990 345 7 0.050 0.350 0.500 0.494 0.150 0.800 182 0.850 207 0.900 239 0.950 292 0.990 407 8 0.050 0.400 0.500 0.497 0.100 0.800 407 0.850 463 0.900 538 0.950 660 0.990 924 9 0.050 0.440 0.550 0.500 0.110 0.800 341 0.850 387 0.900 450 0.950 552 0.990 772 10 0.050 0.413 0.550 0.500 0.137 0.800 222 0.850 252 0.900 292 0.950 357 0.990 498 11 0.050 0.435 0.580 0.500 0.145 0.800 199 0.850 225 0.900 261 0.950 320 0.990 446 12 0.050 0.464 0.580 0.500 0.116 0.800 307 0.850 348 0.900 405 0.950 496 0.990 694 13 0.050 0.450 0.600 0.499 0.150 0.800 186 0.850 211 0.900 244 0.950 298 0.990 415 14 0.050 0.480 0.600 0.498 0.120 0.800 286 0.850 325 0.900 377 0.950 462 0.990 645 15 0.050 0.480 0.640 0.496 0.160 0.800 162 0.850 184 0.900 212 0.950 260 0.990 361 16 0.050 0.512 0.640 0.494 0.128 0.800 248 0.850 282 0.900 327 0.950 400 0.990 558 program samptwo.sas (jec) 04MAY05 18:25