Power and Sample Size Calculation
Power and Sample Size Calculation
Statistical power is positively correlated with the sample size, which means that
given the level of the other factors, a larger sample size gives greater power. However,
researchers are also faced with the decision to make a difference between statistical
difference and scientific difference. Although a larger sample size enables researchers to
find smaller difference statistically significant, that difference may not be large enough be
scientifically meaningful. Therefore, as consultants, we would like to recommend that our
clients have an idea of what they would expect to be a scientifically meaningful
difference before doing a power analysis to determine the actual sample size needed.
parameters (their means and variances) and what confidence or significance level is
needed in the study.
Hand Calculation.
We will use an example to illustrate how a researcher can calculate the sample
size needed for a study. Given that a researcher has the null hypothesis that =0 and
alternative hypothesis that =1 0, and that the population variance is known as 2.
Also, he knows that he wants to reject the null hypothesis at a significance level of
which gives a corresponding Z score, called it Z/2. Therefore, the power function will be
P{Z> Z/2 or Z< -Z/2|1}=1-[Z/2-(1-0)/(/n)]+[-Z/2-(1-0)/(/n)].
That is a function of the power and sample size given other information known and the
researcher can get the corresponding sample size for each power level.
For example, if the researcher learns from literature that the population follows a
normal distribution with mean of 100 and variance of 100 under the null hypothesis and
he/she expects the mean to be greater than 105 or less than 95 under the null hypothesis
and he/she wants the test to be significant at 95% level, the resulting power function
would be:
Power=1-[1.96-(105-100)/(10/n)]+[-1.96-(95-100)/(10/n)], which is,
Power=1-[1.96-n/2]+[-1.96+n/2].
That function shows a relationship between power and sample size. For each level
of sample size, there is a corresponding sample size. For example, if n=20, the
corresponding power level would be about 0.97, or, if the power level is 0.95, the
corresponding sample size would be 16.
test=diff
= 2
5
.
run;
power = .80;
Analysis
Statement
MULTREG
ONECORR
DIST=FISHERZ
Correlation: t test
ONECORR
DIST=T
ONESAMPLEFREQ
TEST=EXACT
ONESAMPLEFREQ
TEST=Z
ONESAMPLEFREQ
TEST=ADJZ
One-sample t test
ONESAMPLEMEANS
TEST=T
ONESAMPLEMEANS
TEST=T DIST=LOGNORMAL
ONESAMPLEMEANS
TEST=EQUIV
ONESAMPLEMEANS
TEST=EQUIV
DIST=LOGNORMAL
ONESAMPLEMEANS
CI=T
ONEWAYANOVA
TEST=CONTRAST
ONEWAYANOVA
TEST=OVERALL
PAIREDFREQ
PAIREDFREQ
DIST=NORMAL
Paired t test
PAIREDMEANS
TEST=DIFF
PAIREDMEANS
TEST=RATIO
PAIREDMEANS
TEST=EQUIV_DIFF
PAIREDMEANS
TEST=EQUIV_RATIO
PAIREDMEANS
CI=DIFF
TWOSAMPLEFREQ
TEST=PCHI
TWOSAMPLEFREQ
TEST=FISHER
TWOSAMPLEFREQ
TEST=LRCHI
TWOSAMPLEMEANS
TEST=DIFF
TWOSAMPLEMEANS
TEST=DIFF_SATT
TWOSAMPLEMEANS
TEST=RATIO
TWOSAMPLEMEANS
TEST=EQUIV_DIFF
TWOSAMPLEMEANS
TEST=EQUIV_RATIO
Options
lognormal data
Two-sample confidence interval for mean difference
TWOSAMPLEMEANS
CI=DIFF
TWOSAMPLESURVIVAL
TEST=LOGRANK
TWOSAMPLESURVIVAL
TEST=GEHAN
TWOSAMPLESURVIVAL
TEST=TARONEWARE
power level, he/she may want to specify the range and interval of power level in
the Power row in the menu.
The corrected sum of squares (CSS) is calculated as the sum of the
squared distance from each treatment mean to the grand-mean. For example, there
are two treatments with mean of 10 and 20, respectively. That gives us a grand
mean of (10+20)/2=15 (assuming equal cell size). Therefore, the corrected sum
of squares is: (10-15)2+(20-15)2=50.
Once the request for calculation is submitted, SAS will pop-up a window
which includes a table of power level and corresponding sample size. You can
also ask SAS to generate a curve showing the relation between power level and
sample size. Another important feature of SAS menu is that you can generate the
code by which you use to do the power calculation and it will be displayed in
another window.
Example Output
An example is shown below using the CSS mentioned above and
assuming a one-way ANOVA design is used. We also assume that the standard
deviation is 20 and the alpha is 0.05. We want to find out the corresponding
sample size for each power level ranging from 0.8 to 0.99 at 0.01 intervals. The
outputs should look like the following:
One-Way ANOVA
# Treatments = 2 CSS of Means = 50
Standard Deviation = 20 Alpha = 0.05
N per
Power Group
0.800
0.810
0.820
64
66
68
0.830
69
0.840
71
0.850
73
0.860
75
0.870
78
0.880
80
0.890
83
0.900
86
0.910
89
0.920
92
0.930
96
0.940
100
0.950
105
0.960
112
0.970
119
0.980
130
0.990
148
The output above gives the required sample size per group for each power
level. For example, if we want a power level of 0.9, we actually need 86*2=172
subjects in the sample.
Example from Consulting Service Clients Project
Explanation of code:
onewayanova - Designates the type of design.
test=contrast - Designates the type of test for which the power will be computed.
In this case, a contrast which will compare subjects receiving the drug to subjects
not receiving the drug is the main test of interest.
9
groupmeans - Step where each of the four group means are listed. If other
magnitudes of mean difference were of interest, these could be modified.
stddev - Step where the standard deviation is specified.
alpha - Step where the significance level is specified.
contrast - Specifies the details of the contrast. In this case, the contrast will be
between groups 1 and 3 (men and women not taking the drug) and groups 2 and 4
(men and women taking the drug). If a contrast that compares men and women
were of interest, this step could read: contrast= (1 1 -1 -1).
ntotal =. - Specifies that the total sample size is what needs to be calculated. This
could be given and the power for that particular sample size could be calculated
instead.
power =0.8 - Step where the desired power is specified. This could be calculated
(designated with at '.') if the sample size is given.
plot x=power min=0.6 max=1.0 - This statement provides a power curve which
will display power ranging from 0.6 to 1.0 on the x-axis and the sample size
which corresponds to that power on the y-axis.
ANOVA Power Calculation Results
The POWER Procedure
Single DF Contrast in One-Way ANOVA
Fixed Scenario Elements
Method
Contrast Coefficients
Alpha
Group Means
Standard Deviation
Nominal Power
Number of Sides
Null Contrast Value
Group Weights
Exact
-1 1 -1 1
0.05
93 74.6 86.7 76.5
27
0.8
2
0
1111
Computed N Total
Actual
10
Power Total
0.807
116
From this output, it was determined that 116 subjects total or 116/4=29 subjects
per group will be needed to achieve a power of 0.807 for the specified test.
After seeing this result, the researcher may be willing to either recruit more
subjects to achieve a higher power or recruit less subjects and sacrifice a small reduction
in power. To visualize these kinds of tradeoffs, two power curves were constructed. The
first curve (i), plots sample size as a function of power. The SAS code for this plot was
given previously. This curve would be useful if the researcher knows a range of power
that is desired. From this graph, we can see that lowering the power to 0.75 results in a
sample size of around 100, whereas increasing the power to 0.80 results in a sample size
of around 130.
12
13