/* This SAS code computes sample sizes needed to obtain equivalence tests for comparing two success rate with specified power values. This code is posted in the file power2e.sas */ proc iml; start equiv; p1 = .7; * Enter success probability p1; * for the standard treatment; rrb = 1.2; * Enter upper bound on relative; * risk to maintian equivalence ; * Upper bound for p2/p1 ; power = {.8 .9}; * Enter a set of power values; rra = {1.05 1.10}; * Enter relative risk for some alternatives; alpha = .05; * Enter the type I error level; nb = ncol(power); np = ncol(rra); size = j(1,np); do i1 = 1 to np; * Cycle across alternatives; rr = rra[1,i1]; pa = probit(1-alpha)*sqrt(1+1/rr); do i2 = 1 to np; * Cycle across power levels; pb=probit(power[1,i2])*sqrt(1+1/rrb); size[1,i2] = ((pb+pa)/log(rrb/rr))**2; end; print,,,,,,, p1 RR alpha power; size = int(size) + j(1,np); print 'Sample size for each treatment:' size; end; finish; run equiv;