You are on page 1of 27

Hypothesis Testing II

(The Case of a Small Sample)


EM 521

G. Kksal

METU, 2012
G.Kksal, UIUC, 2011 1
Contents
Statistical inference for the mean (small and normal
sample with unknown variance)
Confidence interval approach
Critical value approach
p-value approach
Power and sample size (small and normal sample
with unknown variance)

2
Hypothesis Testing for the Mean
(Normal and n<30, unknown)
When less than 30 data points are available and is
unknown, we need to make an adjustment.
For normally distributed observations we can make
use of the t-test statistic:
Under the null hypothesis H0: =0
X 0
T0 ~ tn1
s/ n
Reject H0 when t0 is far away from 0.

3
Recall the Biomedical Device Example
A biomedical device is designed to have a mean life
of 5500 hours. 15 randomly selected devices are
tested and the average life is 5625 hours. The sample
standard deviation is 226 hours. A normal plot of the
data shows that observations fall approximately
along a straight line.
Test: the mean life > 5500 hours (vs=5500)

4
Example
Is there strong evidence that > 5500?
Hypotheses:
Null H0:=0=5500 (not ready for sale)
Alternative H1:> 5500 (research hypothesis)
Important for the mean life to be > 5500; strong evidence
needed
Population variance unknown, sample size small
(n=15), z-test can not be used

5
Critical Values For Testing the Mean
(Normal and n<30, unknown)

6
p-Values For Testing the Mean
(Normal and n<30, unknown)

7
CIs For Testing the Mean
(Normal and n<30, unknown)

8
Biomedical Device Example:
Testing Using Critical Value Approach

9
Biomedical Device Example:
Testing Using p-Value Approach
Test H1:>5500 using the p-value
p-value = P (the test statistic T0 takes a value at
least as extreme as 2.142) = P(T0>2.142)

Reject H0 since p-value < = 5%


10
Biomedical Device Example:
Testing Using CI Approach

11
Exercise
A particular brand of diet margarine was analyzed to determine
the level of polysaturated fatty acid (in percentages). A sample
of 6 packages resulted in the following statistics:x = 16.983
and s=0.3189. Data seems to be normally distributed. Is there
enough evidence that the mean acid level differs from 17 %?
Use =5%.
H0: = 17
H1: 17

A) Reject H0
B) Fail to reject H0

12
Solution

13
Margarine Problem: Check Normality First

Probability Plot of x
Normal - 95% CI
99
Mean 16.98
StDev 0.3189
95 N 6
AD 0.143
90
P-Value 0.934
80
70
Percent

60
50
40
30
20

10

1
16.0 16.5 17.0 17.5 18.0 18.5
x

14
Margarine Problem: Using Minitab For
Testing

Minitab: Stat>Basic Statistics>1-Sample t


15
Margarine Problem: Minitab Test Results
One-Sample T: x
Test of mu = 17 vs not = 17
Variable N Mean StDev SE Mean 95% CI T P
x 6 16.983 0.319 0.130 (16.649, 17.318) -0.13 0.903

One-Sample T: x
Test of mu = 17 vs > 17
95% Lower
Variable N Mean StDev SE Mean Bound T P
x 6 16.983 0.319 0.130 16.721 -0.13 0.548

One-Sample T: x
Test of mu = 17 vs < 17
95% Upper
Variable N Mean StDev SE Mean Bound T P
x 6 16.983 0.319 0.130 17.246 -0.13 0.452

Fail to reject all of the one-sided and two-sided hypotheses.


16
Power of t Test

17
Margarine Problem: Power Calculation
Let us find the power of the t-test in detecting 0.02 units of
difference in between the true mean and the hypothesized mean,
using a sample of size 6 and the significance level of 5%.
Then, =0.02, n=6, =0.05, s=0.3189
We would like to compute

P t / 2,n1 T0 t / 2,n1 0.02


This involves finding probability contained between two points
of the noncentral t distribution. This integration must be done
numerically. Hence we need to use a software.

18
Margarine Problem: Power Calculation
Using Minitab
Minitab: Stat>Power and Sample Size>1-Sample t

Power and Sample Size


1-Sample t Test

Testing mean = null (versus not = null)


Calculating power for mean = null + difference
Alpha = 0.05 Assumed standard deviation = 0.3189

Sample
Difference Size Power
0.02 6 0.0518419
19
Margarine Problem: Sample Size
Calculation Using Minitab
Minitab: Stat>Power and Sample Size>1-Sample t

Power and Sample Size


What is the 1-Sample t Test
required sample Testing mean = null (versus not = null)
size for detecting a Calculating power for mean = null + difference
difference of 0.02 Alpha = 0.05 Assumed standard deviation = 0.3189
in the mean with a Sample Target
power of 0.90? Difference Size Power Actual Power
0.02 2674 0.9 0.900068
20
The Power Curve

Power Curve for 1-Sample t Test


1.0
Sample
Size
2674
0.8 A ssumptions
A lpha 0.05
S tDev 0.3189
A lternativ e N ot =
0.6
Power

0.4

0.2

0.0
-0.02 -0.01 0.00 0.01 0.02
Difference

As we try to detect smaller absolute differences between the true mean and the
hypothesized mean using a sample of size 2674 the power of our two-sided test
decreases as shown on the graph. 21
Exercise
What happens to the power when =0?

A) The test looses its power greatly, so it cannot be


trusted.
B) If we use larger samples we can increase the power
at =0.
C) If we use a better test procedure we can increase the
power at =0.
D) The power becomes type I error probability.

22
Solution

23
Power Curves For Different n Values
Power Curve for 1-Sample t Test
1.0
Sample Size
100
1000
2674
0.8
10000
100000

A ssumptions
0.6 A lpha 0.05
S tDev 0.3189
Power

A lternativ e N ot =

0.4

0.2

0.0
-0.02 -0.01 0.00 0.01 0.02
Difference

We need larger samples to detect a particular difference between the true mean and the
hypothesized mean with more power.
24
One-sided Power Curves
The power curves for testing the one-sided hypothesis:
H0: = 0 vs. H1: > 0 using the parameters of the margarine problem.

Power Curve for 1-Sample t Test


1.0
Sample
Size
6
10
0.8
100
1000
10000
0.6 A ssumptions
Power

A lpha 0.05
S tDev 0.3189
A lternativ e >
0.4

0.2

0.0
0.0 0.1 0.2 0.3 0.4 0.5 0.6
Difference

25
Summary: Test Statistics For the Mean
x
known z
/ n
x
n 30 z t
X ~ N ( , 2 ) unknown s/ n
x
n 30 t
s/ n
x
n 30 z
known / n
X ~ N ( , )
2
n 30 NP *
x
n 40 z
unknown s/ n
n 40 NP *

* An appropriate nonparametric test statistic can be used, if the


distribution is very much different from the normal distribution

26
Summary
One-sided and two-sided hypothesis tests for normal
and small samples with unknown variance (t-test)
Confidence interval approach
Critical value approach
p-value approach
Power and sample size (small and normal sample
with unknown variance)

27

You might also like