macro fisherspower p1 p2 n1 n2; sign alpha. #This macro calculates the power of the one-sided Fisher's test for comparing #two fractions defective. #p1 and p2 are the population fractions defective #n1 and n2 are the sizes of the two samples #For Ha: p1 < p2 #Example call: #%fisherspower 0.01 0.05 80 80 #Macro should return power = 0.211135 #Mathews and Malnar, Statistical Trainers and Consultants #217 Third Street, Fairport Harbor, OH 44077 #440-350-0911 #pmathews@apk.net #Copyright Mathews and Malnar, December 2001, All rights reserved. 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