macro fisherspower p1 p2 n1 n2; sign alpha. #Fisher's exact test is the two independent sample test for Ho: p1 = p2 vs. #Ha: p1 < p2. This macro calculates the power of the test for user #specified values of p1, p2, n1, and n2 where: # p1 and p2 are the population fractions defective and # n1 and n2 are the sizes of the two samples. #The specified values of p1 and p2 must meet the condition p1 < p2. #Example call: #%fisherspower 0.01 0.05 80 80 #Macro should return power = 0.211135 #This macro may contain errors - MM&B Inc. is not responsible for its use or misuse. #Mathews Malnar and Bailey, Inc. #217 Third Street, Fairport Harbor, OH 44077 #Phone: 440-350-0911 Fax: 440-350-7210 #E-mail: pmathews@apk.net, paul@mmbstatistical.com #Copyright Mathews and Malnar, December 2001, All rights reserved. #Rev. (2/13/05, PGM): Validated for V14. mconstant p1 p2 n1 n2 alpha x1 x2 bx1 bx2 cbx2 mconstant totn totbad thisp power time default alpha=0.05 #This algorithm searches for the smallest x2 that makes Fisher's test significant for a given x1. #Then it calculates the contribution to the power from the cumulative binomial distribution note note This macro runs very slowly. Please be patient. note The macro is running ... note let totn=n1+n2 let power=0 let x2=0 do x1=0:n1 let thisp=1 while (thisp>alpha) and (x2