/* This program can be used to compute the sample size needed to achieve a specified power for the overall F test in single-factor ANOVA. The user must specify alpha=significance level of test t=number of treatments variance=error variance sumtausq=sum of squared treatment effects The program will compute the power of the overvall F test for number of reps (r) ranging from 2 to any user specified value. By default, the power calculations will stop at r=30, but that is easily changed in the second line of the code below. The original values for alpha, t, variance, and sumtausq correspond to Example 2.3 on page 64 of Kuehl. */ data one; do r=2 to 30; alpha=0.05; t=3; variance=0.22; sumtausq=0.38; dfnum=t-1; dfden=r*t-t; lambda=r*sumtausq/variance; power=1-probf(finv(1-alpha,dfnum,dfden),dfnum,dfden,lambda); output; end; proc print noobs; var r power; run;