Power and Sample Size IIBios 662Michael G. Hudgens, [email protected]://www.bios.unc.edu/∼mhudgens2007-10-30 16:10BIOS 662 1 Power and Sample Size IIOutline• Two sample: Continuous• Two sample: Binary• Case-control studiesBIOS 662 2 Power and Sample Size IITwo sample test: Continuous Outcome• HypsH0: µ1= µ2vs HA: µ16= µ2• Assume homogeneity of variance, σ2known• ThenN =2σ2(z1−α/2+ z1−β)2(µ1− µ2)2= 2z1−α/2+ z1−β∆2• Note there are N observations in each group such thattotal sample size is 2NBIOS 662 3 Power and Sample Size IITwo sample test: Continuous Outcome• A drug company is comparing 2 drugs for lowering LDL-cholesterol• Previous studies have found σ2= 252= 625• A difference of 15 mg/dl is assumed to be important• For α = 0.05 (2-sided) and 1 − β = .9N =2(625)(1.96 + 1.28)2225≈ 59Thus 118 needed for studyBIOS 662 4 Power and Sample Size IITwo sample test: Continuous Outcome with σ unknown• What if the variance is not known?• For N1= N2= N, can showY1− Y2spq2N∼ t2N−2,λwhereλ = ∆rN2BIOS 662 5 Power and Sample Size IITwo sample test: Continuous Outcome with σ unknown• R# by hand> 1-pt(qt(.975,116), 116, 15/25*sqrt(59/2))[1] 0.8982732> power.t.test(59, delta=15, sd=25)Two-sample t test power calculationn = 59delta = 15sd = 25sig.level = 0.05power = 0.8982732alternative = two.sidedNOTE: n is number in *each* groupBIOS 662 6 Power and Sample Size IITwo sample test: Continuous Outcome with σ unknown• SASproc power;twosamplemeansmeandiff = 15ntotal = 118stddev = 25power = .;run;/* outputComputed PowerPower0.898*/BIOS 662 7 Power and Sample Size IITwo sample test: Continuous Outcome with σ unknown• Given β, solve for N1 − β = Pr[T ≥ t2N−2,1−α/2]where T ∼ t2N−2,∆√N/2• E.g., suppose β = .1, ∆ = .5. Numerical search in R:> N <- 50; 1-pt(qt(.975,2*N-2), 2*N-2, 1/2*sqrt(N/2))[1] 0.6968888> N <- 90; 1-pt(qt(.975,2*N-2), 2*N-2, 1/2*sqrt(N/2))[1] 0.9155872> N <- 86; 1-pt(qt(.975,2*N-2), 2*N-2, 1/2*sqrt(N/2))[1] 0.9032299> N <- 85; 1-pt(qt(.975,2*N-2), 2*N-2, 1/2*sqrt(N/2))[1] 0.899894BIOS 662 8 Power and Sample Size IITwo sample test: Continuous Outcome with σ unknown• R> power.t.test(power=.9, delta=.5)Two-sample t test power calculationn = 85.03129delta = 0.5sd = 1sig.level = 0.05power = 0.9alternative = two.sidedBIOS 662 9 Power and Sample Size IITwo sample test: Continuous Outcome with σ unknown• SASproc power;twosamplemeansmeandiff = 15ntotal = .stddev = 30power = .9;run;/* outputComputed N TotalActual NPower Total0.903 172*/BIOS 662 10 Power and Sample Size IITwo sample test: Binary Outcome• HypsH0: π1= π2vs HA: π16= π2• ThenN ≈2σ2(z1−α/2+ z1−β)2(π1− π2)2whereσ2=12{π1(1 − π1) + π2(1 − π2)}see page 161 of text• Again there are N observations in each group such thattotal sample size is 2NBIOS 662 11 Power and Sample Size IITwo sample test: Binary Outcome• Suppose π1= .2727, π2= .2, α = 0.05 (two-sided),1 − β = .9. ThenN ≈2σ2(z1−α/2+ z1−β)2(π1− π2)2= 712• SASproc power;twosamplefreqrefp = .2pdiff = .0727ntotal = .power = .9;run;BIOS 662 12 Power and Sample Size IITwo sample test: Binary OutcomeThe POWER ProcedurePearson Chi-square Test for Two ProportionsFixed Scenario ElementsDistribution Asymptotic normalMethod Normal approximationReference (Group 1) Proportion 0.2Proportion Difference 0.0727Nominal Power 0.9Number of Sides 2Null Proportion Difference 0Alpha 0.05Group 1 Weight 1Group 2 Weight 1Computed N TotalActual NPower Total0.900 1432BIOS 662 13 Power and Sample Size IITwo sample test: Binary Outcome• Why the difference? SAS is using a different approxi-mation, which we now derive (cf Fleiss 1981)• For N1= N2= N, Pearson’s chi-square test statistic isequivalent toZ =p2− p1p2¯p¯q/Nwhere¯p = (p1+ p2)/2,¯q = 1 −¯p• Consider alternative π2− π1= δA> 0.BIOS 662 14 Power and Sample Size IITwo sample test: Binary Outcome• Power to detect δAof two-sided testPr[Z > z1−α/2|δA]+Pr[Z < zα/2|δA] ≈ Pr[Z > z1−α/2|δA]• Need to know distribution of Z under HA‘E(p2− p1) = δAV ar(p2− p1) =π2(1 − π2)N+π1(1 − π1)NBIOS 662 15 Power and Sample Size IITwo sample test: Binary Outcome1 − β = Pr"p2− p1p2¯p¯q/N> z1−α/2| δA#= Prhp2− p1> z1−α/2p2¯p¯q/N | δAi= Pr"(p2− p1) − δApV ar(p2− p1)>z1−α/2p2¯p¯q/N − δApV ar(p2− p1)| δA#BIOS 662 16 Power and Sample Size IITwo sample test: Binary Outcome• Implying−z1−β=z1−α/2p2¯p¯q/N − δApV ar(p2− p1)• Using¯p¯q ≈¯π(1 −¯π) where¯π = (π1+ π2)/2 yieldsz1−βpV ar(p2− p1) + z1−α/2p2¯π(1 −¯π)/N = δABIOS 662 17 Power and Sample Size IITwo sample test: Binary Outcome• Thereforez1−βpπ1(1 − π1) + π2(1 − π2) + z1−α/2p2¯π(1 −¯π)δA=√N• Thus, sample size required per arm to detect δAwith1 − β power is{z1−βpπ1(1 − π1) + π2(1 − π2) + z1−α/2p2¯π(1 −¯π)}2δ2ABIOS 662 18 Power and Sample Size IITwo sample test: Binary Outcome• In R by hand# sample size formula for comparing two# binomial proportions based on fleiss (second edition) page 41ss_fleiss <- function(p1,p2,alpha,power){q1 <- 1-p1q2 <- 1-p2pbar <- (p1+p2)/2qbar <- 1-pbarnum <- qnorm(1-alpha/2)*sqrt(2*pbar*qbar)+qnorm(power)*sqrt(p1*q1+p2*q2)den <- (p2-p1)(num/den)^2}> ss_fleiss(.2,.2727,.05,.9)[1] 715.5618BIOS 662 19 Power and Sample Size IIGraphical SummarySample size (per arm) for comparing π1with π2with α = .05 (one-sided) and 90%power0.0 0.2 0.4 0.6 0.8 1.00 50 100 150 200 250 300ππ2Nππ1=.1ππ1=.3ππ1=.5BIOS 662 20 Power and Sample Size IICase-Control: Binary Exposure• HypsH0: OR = 1 vs HA: OR 6= 1OR =odds(dis + |exp+)odds(dis + |exp−)• RecallDisease No diseaseExposed π11π12Unexposedπ21π22BIOS 662 21 Power and Sample Size IICase-Control: Binary ExposureOR =odds(dis+|exp+)odds(dis+|exp−)=π11/π12π21/π22=π11/π21π12/π22=odds(exp+|dis+)odds(exp+|dis−)BIOS 662 22 Power and Sample Size IICase-Control: Binary Exposure• HypsH0: OR = 1 vs HA: OR 6= 1• By previous slideOR =π1/(1 − π1)π2/(1 − π2)where π1= Pr(exp + |case), π2= Pr(exp + |control)• For specified OR and π2we can determine π1π1=π2OR1 + π2(OR − 1)BIOS 662 23 Power and Sample Size IICase-Control: Binary Exposure• Example:Cases: Neural tube defect babiesControls: Normal babiesExposure: Self reported dieting to lose weight duringfirst trimester• It is estimated
View Full Document