Transcript Document

Sample Size Determination
In the Context of
Hypothesis Testing
Sample Size2: 1
Recall, in context of Estimation, Sample Size is
based upon:
• the width of the Confidence interval:
• The confidence level (1 – a)
 confidence coefficient, z1-a/2
• The population standard error, s/n
w
)
(
x – z1-a/2(s/n)
x + z1-a/2(s/n)
x
4  z1a / 2  s 2
n
w2
2
Sample Size2: 2
Sample size in Context of Hypothesis Testing:
•
Need to consider POWER as well as
confidence level
Example: Suppose we have a hypothesis on one
mean:
 Ho: mo = 100
vs.
Ha: mo 100
 s = 10
 a = .05
If the true mean is in fact ma = 105,
 what size sample is required so that the power
of the test is (1b) = .80 ?
Sample Size2: 3
For our hypothesis test,
we will reject Ho for x greater than C1
or less than C2
a/2 = .025
a/2 = .025
mo=100
C2  moZ1-a/2(s/n)
C1  mo+Z1-a/2(s/n)
Sample Size2: 4
Let’s look at these decision points (C1 and C2)
relative to a specific alternative.
Suppose, in fact, that ma = 105.
We will reject Ho
• if x is greater than C1
• or x is less than C2
b  Pr( fail to reject Ho | m  105)
C2
Distribution
based on Ha
C1
ma=105
Sample Size2: 5
b  Pr( fail to reject Ho | ma )  .20
 Pr(C2  x  C1 ) | ma )
We want b = .20
for power=.80
 Pr( x  C1 ) | ma )  Pr( x  C2 ) | ma )
C1  ma 
C2  ma 


 Pr  zb 
  Pr  zb 

s/ n 
s/ n 


We want b = .20
 zb = -.842
C2
C1 ma
Sample Size2: 6
Note for sample size determination:
 a, b are set by the investigator
 Both a specific null (mo) and a specific
alternative (ma) must be specified
 we assume that the same variance s2 holds for
both the null and alternative distributions
a/2
a/2
b
m0
C1  mo+z1-a/2(s/n)
ma
C1  maz1b (s/n)
Sample Size2: 7
We now have:
s
C1  mo +  z1a / 2 
C1 in terms of
n
both the Ho and Ha
distributions:
z1 b 
C1  ma
s/ n
 C1  ma   z1 b 
s
n
Setting these equal:
mo +  z1a / 2 
s
n
 ma   z1 b 
s
n
Then solve for n.
Sample Size2: 8
Sample Size is then:
2
z
+
z
s
 1a / 2 1b 
2
n
 m a  mo 
2
Note:
•
Always use positive values for z1-a/2 and z1b
we defined CI using  positive z)
Sample Size2: 9
In our example:
 s = 10
 a = .05  z1-a/2 = 1.96
 b = .20  z1b = .842
 mo = 100
 ma = 105
2
z
+
z
s
 1a / 2 1b 
2
n
 m a  mo 
2
2
1.96
+
.842
10


2
 n
105  100 
2
 31.39
Or a sample size of n=32 is needed.
Sample Size2: 10
If we change the desired power to 1b = .90:
 b = .10  z1b = 1.28
2
1.96
+
1.28
10


2
n
105  100 
2
 41.99
Or a sample size of n=42 is needed.
Sample Size2: 11
In the context of hypothesis testing, sample size is
a function of:
 s2, the population variance
 a = .05  z1-a/2 , Type I error rate
 b = .20  z1b ,
Type II error rate
 Distance between mo , hypothesized mean and
ma , a specific alternative
2
z
+
z
s
 1a / 2 1b 
2
n
 m a  mo 
2
Sample Size2: 12
Using Minitab to estimate Sample Size:
Stat  Power and Sample Size  1-Sample Z
Difference between
mo and ma
s
Desired power (separate by
spaces if entering several)
2-sided test
Sample Size2: 13
Power and Sample Size
1-Sample Z Test
Testing mean = null (versus not = null)
Calculating power for mean = null + difference
Alpha = 0.05 Sigma = 10
Sample
Difference Size
5
32
5
43
Target
Power
0.8000
0.9000
Actual
Power
0.8074
0.9064
Sample Size2: 14
Sample size and power for comparing means of 2
independent groups.
In the example comparing LOS for elective vs.
emergency patients, we observed a difference
between sample means of 3.3 days – but found that
this was NOT statistically significantly different from
zero.
However 3.3 days is a large, expensive difference in
length of stay. Our data had relatively large observed
variance, and small n.
• What was the power of our study to detect a
difference of 3.3 days?
• What sample size would be needed per group to
find a difference of 3 days or more significantly
different from zero?
Sample Size2: 15
In Minitab: Stat  Power and Sample Size  2-sample t
To evaluate power:
1. Enter sample sizes
2. Enter observed
difference in means
3. Enter standard
deviation
s
Set a and 1or 2- sided
test, using
options
menu.
Sample Size2: 16
In Minitab: Stat  Power and Sample Size  2-sample t
Power and Sample Size
2-Sample t Test
Testing mean 1 = mean 2 (versus not =)
Calculating power for mean 1 = mean 2 + 3.3
Alpha = 0.05
Sigma = 10
Sample
Size
Power
14
0.1342
11
0.1142
Note: Minitab assumes equal n’s for the 2 groups,
and only gives space for one value of s
Clearly, our power to detect a difference as large
as 3.3 days was only about 12% -- not very good!
Sample Size2: 17
In Minitab: Stat  Power and Sample Size  2-sample t
To estimate sample size:
1. Enter desired power
s
2. Enter desired
significant difference
in means
3. Enter standard
deviation
Sample Size2: 18
Power and Sample Size
2-Sample t Test
Testing mean 1 = mean 2 (versus not =)
Calculating power for mean 1 = mean 2 + 3
Alpha = 0.05
Sigma = 10
Sample
Size
Target
Power
Actual
Power
176
0.8000
0.8014
235
0.9000
0.9007
Note: sample sizes are per group. If this seems
excessive – is your estimate of the standard deviation
reasonable?
I used the larger of the 2 observed SD here. You might
want to compute a pooled SD, and try that.
Sample Size2: 19