Chap 9
Chap 9
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
Hypothesis Testing
Statistical hypothesis
A statistical hypothesis is a statement about the
parameters of one or more populations.
For example,
H 0 : 50 centimeters per second
H1 : 50 centimeters per second
H 0 is the null hypothesis and H1 is a two-
sided alternative hypothesis
Type I error
Rejecting the null hypothesis H 0 when it is true
is defined as a type I error
Type II error
Failing to reject the null hypothesis when it is
false is defined as a type II error
Probability of type I error
= P(type I error) = P(reject H 0 when H 0 is
true)
Probability of type II error
= P(type II error) = P(fail to reject H 0 when H 0
is false)
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
Null hypothesis (H0) is Null hypothesis (H0) is
true false
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
Power
1
The probability of correctly rejecting a false null
hypothesis
Sensitivity: the ability to detect differences
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
Formulating one-sided hypothesis
H0 : = 1.5 MPa
H1 : > 1.5 Mpa (We want)
Or
H 0 : = 1.5 MPa
H1 : < 1.5 Mpa (We want)
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
Formulating one-sided hypothesis
H0 : = 1.5 MPa
H1 : > 1.5 Mpa (We want)
Or
H 0 : = 1.5 MPa
H1 : < 1.5 Mpa (We want)
P-value
The P-value is the smallest level of significance
that would lead to rejection of the null
hypothesis H 0 with the given data
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
General procedure for hypothesis tests
Specify the test statistic to be used (such as Z 0 )
Specify the location of the critical region (two-
tailed, upper-tailed, or lower-tailed)
Specify the criteria for rejection (typically, the
value of , or the P-value at which rejection
should occur)
Practical significance
Be careful when interpreting the results from
hypothesis testing when the sample size is large,
because any small departure from the
hypothesized value 0 will probably be
detected, even when the difference is of little or
no practical significance
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
Example 9-1 Propellant Burning Rate
Suppose that if the burning rate is less than 50
centimeters per second, we wish to show this
with a strong conclusion.
H 0 : 50 centimeters per second
H1 : 50 centimeters per second
Since the rejection of H 0 is always a strong
conclusion, this statement of the hypotheses will
produce outcome if H 0 is rejected.
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
Exercise 9-27
A random sample of 500 registered voters in
Phoenix is asked if they favor the use of
oxygenated fuels year-round to reduce air
pollution. If more than 400 voters respond
positively, we will conclude that more than 60%
of the voters favor the use of these fuels.
(a) Find the probability of type I error if exactly
60% of the voters favor the use of these fuels.
(b) What is the type II error probability if
75% of the voters favor this action?
Hint: use the normal approximation to the
binomial.
Contents, figures, and exercises come from the textbook: Applied Statistics and Probability
for Engineers, 5th Edition, by Douglas C. Montgomery, John Wiley & Sons, Inc., 2011.
Tests on the Mean of a Normal
Distribution,Variance Known
Hypothesis tests on the mean
Hypotheses, two-sided alternative
H 0 : 0
H1 : 0
x 0
Test statistic: z0
/ n
P-value: P 2[1 (| z0 |)]
Reject H 0 if z0 z / 2 or z0 z / 2
Hypotheses, upper-tailed alternative
H 0 : 0
H1 : 0
P-value: P 1 ( z0 )
Reject H 0 if z0 z
Hypotheses, lower-tailed alternative
H 0 : 0
H1 : 0
P-value: P ( z0 )
Reject H 0 if z0 z
Type II error and choice of sample size
Finding the probability of type II error
Hypotheses, two-sided alternative
H 0 : 0
H1 : 0
Suppose the true value of the mean under H1 is
0
Test statistic:
x 0 x ( 0 ) n
z0
/ n / n
Under H1 n
z0 N ,1
n n
z / 2 z / 2
Type II error and choice of sample size
Sample size formulas
If 0
n n
z / 2 z / 2
n
z / 2
Let z be the 100 upper percentile of the
standard normal distribution. Then ( z )
n
z z / 2
Note
n n
z / 2 z
/ 2
n n
1 z / 2
1 z / 2
n n
z / 2 z / 2
Sample size for a two-sided test on the mean,
variance known
( z / 2 z ) 2 2
n where 0
2
( z z ) 2 2
n where 0
2
Operating characteristic (OC) curves
Curves plotting against a parameter d for
various sample size n
| 0 |
d
See Appendix VII
For a given n and d , find .
For a given and d , find n
Large-sample test
If n 40 , the sample standard deviation s can
be substituted for in the test procedures
with little effect
Example 9-2 Propellant Burning Rate
2 , 0.05 , n 25 , x 51.3 ,
Specifications require that the mean burning rate
must be 50 centimeters per second. What
conclusions should be drawn?
Example 9-3 Propellant Burning Rate Type II Error
Suppose that the true burning rate is 49
centimeters per second. What is for the two-
sided test with 0.05 , 2 , and n 25 ?
Example 9-4 Propellant Burning Rate Type II Error
from OC Curve
Suppose the true mean burning rate is 51
centimeters per second.
| 0 | | | 1
d
2
Example 9-4 Propellant Burning Rate Sample Size
from OC Curve
Design the test so that if the true mean burning
rate differs from 50 centimeters per second by
as much an 1 centimeter per second, the test
will detect this with a high probability 0.90.
1 0.90
Exercise 9-47
Medical researchers have developed a new
artificial heart constructed primarily of titanium
and plastic. The heart will last and operate
almost indefinitely once it is implanted in the
patient’s body, but the battery pack needs to be
recharged about every four hours. A random
sample of 50 battery packs is selected and
subjected to a life test. The average life of these
batteries is 4.05 hours. Assume that battery life
is normally distributed with standard deviation
0.2 hour.
(a) Is there evidence to support the claim that
mean battery life exceeds 4 hours? Use 0.05 .
(b) What is the P-value for the test in part (a)?
Exercise 9-47
(c) Compute the power of the test if the true
mean battery life is 4.05 hours.
(d) What sample size would be required to
detect a true mean battery life of 4.5 hours if we
wanted the power of the test to be at least 0.9?
(e) Explain how the question in part (a) could be
answered by constructing a one-sided
confidence bound on the mean life.
Tests on the Mean of a Normal
Distribution,Variance Unknown
Hypothesis tests on the mean
Hypotheses, two-sided alternative
H 0 : 0
H1 : 0
x 0
Test statistic: T0
S/ n
P-value: P 2P(Tn1 | t0 |)
Reject H 0 if t0 t / 2,n 1 or t0 t / 2,n 1
Hypotheses, upper-tailed alternative
H 0 : 0
H1 : 0
P-value: P P(Tn 1 t0 )
Reject H 0 if t0 t , n 1
Hypotheses, lower-tailed alternative
H 0 : 0
H1 : 0
P-value: P P(Tn1 t0 )
Reject H 0 if t0 t ,n 1
Type II error and choice of sample size
Finding the probability of type II error
Hypotheses, two-sided alternative
H 0 : 0
H1 : 0
Suppose the true value of the mean under H1 is
0
Test statistic: n ( x ( 0 )) n
x 0
t0
S/ n (n 1) S 2 1
Under H1 2 n 1
t 0 is of the noncentral t distribution with
degrees of freedom and noncentrality n /
parameter .
PDF of noncentral t distribution
02 2 (n 1) s 2 02 2
P{ 2 1 / 2,n 1 2 / 2,n 1 | H1}
2
Type II error and choice of sample size
Finding the probability of type II error
Hypotheses, upper-tailed alternative
H 0 : 2 02
H 1 : 2 02
Suppose the true value of the variance under H1
is 2
(n 1) s 2
P{ 2
, n 1 | H 1}
02
(n 1) s 2 02 2
P{ 2 ,n 1 | H1}
2
Type II error and choice of sample size
Finding the probability of type II error
Hypotheses, lower-tailed alternative
H 0 : 2 02
H 1 : 2 02
Suppose the true value of the variance under H1
is 2
(n 1) s 2
P{1 ,n 1
2
| H 1}
02
02 2 (n 1) s 2
P{ 2 1 ,n 1 | H 1}
2
Type II error and choice of sample size
Finding the probability of type II error
Hypotheses, two-sided alternative
Operating characteristic (OC) curves
Curves plotting against a parameter for
various sample size n
0
See Appendix VII
Example 9-8 Automated Filling
n 20 , s 2 0.0153 , 0.05.
Is there evidence in the sample data to suggest that
the manufacture has a problem with underfilled or
overfilled bottles? ( 2 0.01 )
Example 9-8 Automated Filling Sample Size
0 0.10 , 0.125
Find
Exercise 9-83
Recall the sugar content of the syrup in canned
peaches from Exercise 8-46. Suppose that the
variance is thought to be 2 18 (milligrams)2. Recall
that a random sample of n 10 cans yields a sample
standard deviation of s 4.8 milligrams.
(a) Test the hypothesis H 0 : 18 versus H1 : 2 18
2
P{ p0 z / 2 p0 (1 p0 ) / n p p0 z / 2 p0 (1 p0 ) / n | H1}
p0 z / 2 p0 (1 p0 ) / n p p0 z / 2 p0 (1 p0 ) / n p
p (1 p ) / n p (1 p ) / n
Type II error and choice of sample size
Finding the probability of type II error
Hypotheses, upper-tailed alternative
H 0 : p p0
H1 : p p0
Suppose the true value of the proportion under H1
is p
P{ p p0 z p0 (1 p0 ) / n | H1}
p0 z p0 (1 p0 ) / n p
p (1 p ) / n
Type II error and choice of sample size
Finding the probability of type II error
Hypotheses, lower-tailed alternative
H 0 : p p0
H1 : p p0
Suppose the true value of the proportion under H1
is p
P{ p0 z p0 (1 p0 ) / n p | H1}
p0 z p0 (1 p0 ) / n p
1
p (1 p ) / n
Type II error and choice of sample size
Two-sided alternative
Let z be the 100 upper percentile of the
standard normal distribution. Then ( z )
p0 z / 2 p0 (1 p0 ) / n p p0 z / 2 p0 (1 p0 ) / n p
p (1 p ) / n p (1 p ) / n
p0 z / 2 p0 (1 p0 ) / n p
p(1 p) / n
p0 z / 2 p0 (1 p0 ) / n p
z
p(1 p) / n
2
z / 2 p0 (1 p0 ) z p(1 p)
n
p p0
Type II error and choice of sample size
Upper-tailed alternative
Let z be the 100 upper percentile of the
standard normal distribution. Then ( z )
p0 z p0 (1 p0 ) / n p
p (1 p ) / n
p0 z p0 (1 p0 ) / n p
z
p(1 p) / n
2
z p0 (1 p0 ) z p(1 p)
n
p p0
Type II error and choice of sample size
Lower-tailed alternative
Let z be the 100 upper percentile of the
standard normal distribution. Then ( z )
p0 z p0 (1 p0 ) / n p
1
p (1 p ) / n
p0 z p0 (1 p0 ) / n p
p (1 p ) / n
p0 z p0 (1 p0 ) / n p
z
p(1 p) / n
2
z p0 (1 p0 ) z p(1 p)
n
p p0
Example 9-10 Automobile Engine Controller
p 0.05 , 0.05 , n 200
The semiconductor manufacturer takes a random
sample of 200 devices and finds that four of them
are defective. Can the manufacturer demonstrate
process capability for the customer? ( p 0.05 )
Example 9-11 Automobile Engine Controller Type II
Error
Suppose that its process fallout is really p 0.03
.
What is the -error for a test of process capability
that uses n 200 and 0.05 ?
Exercise 9-95
In a random sample of 85 automobile engine
crankshaft bearings, 10 have a surface finish
roughness that exceeds the specifications. Does this
data present strong evidence that the proportion of
crankshaft bearings exhibiting excess surface
roughness exceeds 0.10?
(a) State and test the appropriate hypotheses using
0.05 .
(b) If it is really the situation that p 0.15, how likely
is it that the test procedure in part (a) will not
reject the null hypotheses?
(c) If p 0.15 , how large would the sample size
have to be for us to have a probability of correctly
rejecting the null hypothesis of 0.9? ,
,
Testing for Goodness of Fit
Test the hypothesis that a particular distribution will
be satisfactory as a population model
Based on the chi-square distribution
n observations, p is the number of parameters of
the hypothesized distribution estimated by sample
statistics
Oi : the observed frequency in the i th class
interval
Ei : the expected frequency in the i th class
interval k
(O E ) 2
Test statistic: X 0
2 i i
i 1 Ei
P-value: P P( k p1 0 )
2 2
Reject the hypothesis if 0 2
2
,k p 1
Example 9-12 Printed Circuit Board Defects, Poisson
Distribution
Number of defects: 0, observed frequency: 32
Number of defects: 1, observed frequency: 15
Number of defects: 2, observed frequency: 9
Number of defects: 3, observed frequency: 4
Example 9-13 Power Supply Distribution, Continuous
Distribution
x 5.04 , s 0.08 , n 100
A manufacturer engineer is testing a power supply
used in a notebook computer and, using 0.05 ,
wishes to determine whether output voltage is
adequately described by a normal distribution.
Exercise 9-101
The number of cars passing eastbound through the
intersection of Mill and University Avenues has been
tabulated by a group of civil engineering students.
They have obtained the data in the adjacent table:
(a) Does the assumption of a Poisson distribution
seem appropriate as a probability model for this
process? Use 0.05.
(b) Calculate the P-value for this test.
Data: (40, 14), (41, 24), …
Contingency Table Tests
Test the hypothesis that two methods of
classification are statistically independent
Based on the chi-square distribution
n observations, r c contingency table
Oij : the observed frequency for level i of the first
classification and level j for the second
classification
c
1 r
uˆi Oij , vˆ j Oij ,
1
Eij nuˆi vˆ j
n j 1 n i 1
r c (O E ) 2
Test statistic: X 02
ij ij
i 1 j 1 Eij
P-value: P P( ( r 1)(c1) 0 )
2 2
Reject the hypothesis if 0 ,( r 1)( c 1)
2 2
Example 9-13 Health Insurance Plan Preference
A company has to choose among three health
insurance plans. Management wishes to know
whether the preference for plans is independent of
job classification and wants to use 0.05 .
n 500 , data: …
Exercise 9-107
A study is being made of the failure of an electronic
component. There are four types of failures possible
and two mounting positions for the device
A B C D
1 20 48 20 7
2 4 17 6 12
H : ~ ~
1 0
1
P-value: P P( R r when p )
2
Reject H 0 if P
Hypotheses, lower-tailed alternative
~ ~
H 0 : 0
H : ~ ~
1 0
1
P-value: P P ( R r when p )
2
Reject H 0 if P
Appendix Table VIII ( r )
Hypotheses, two-sided alternative
H0 : ~ ~
0
H1 : ~ ~
0
Reject H 0 if min( r , r ) r
Hypotheses, upper-tailed alternative
~ ~
H 0 : 0
~ ~
H1 : 0
Reject H 0 if r r
Hypotheses, lower-tailed alternative
H : ~ ~
0 0
~ ~
H :
1 0
Reject H 0 if
r r
Ties in the sign test
Values of X i exactly equal to ~ should be set
0
aside and the sign test applied to the remaining
data
Normal approximation for sign test statistic
R 0.5n
Z0
0.5 n
Reject H if | z | z
0 0 /2for H : ~ ~
1 0
or if z0 z for H1 : ~ ~0
or if z0 z for H1 : ~ ~0
Type II error for the sign test
Finding the probability of type II error
Not only a particular value of ~ , say, ~ , must
be used but also the form of the underlying
distribution will affect the calculations
Wilcoxon signed-rank test
Appendix Table IX ( )
w
Rank the absolute differences | X i 0 | in ascending
order, and then give the ranks the signs of their
corresponding differences
w : the sum of the positive ranks
w : the absolute value of the sum of negative ranks
Hypotheses, two-sided alternative
H 0 : 0
H1 : 0
Reject H 0 if min( w , w ) w
Wilcoxon signed-rank test
Appendix Table IX ( )
w
Hypotheses, upper-tailed alternative
H 0 : 0
H1 : 0
Reject H 0 if w w
Hypotheses, lower-tailed alternative
H 0 : 0
H1 : 0
Reject H 0 if w w
Ties in the Wilcoxon signed-rank test
If several observations have the same absolute
magnitude, they are assigned the average of the
ranks that they would receive if they differed
slightly from one another
Normal approximation for Wiocoxon signen-rank
test statistic
W n(n 1) / 4
Z0
n(n 1)( 2n 1) / 24
~ ~
Reject H 0 if | z0 | z / 2 for H1 : 0
or if z0 z for H1 : ~ ~0
or if z0 z for H1 : ~ ~0
Example 9-15 Propellant Shear Strength Sign Test
n 20
We would like to test the hypothesis that the
median shear strength is 13790 kN/m2, using 0.05
Example 9-16 Propellant Shear Strength Wilcoxon
Signed-Rank Test
n 20
We would like to test the hypothesis that the
median shear strength is 13790 kN/m2, using 0.05
Exercise 9-117
A primer paint can be used on aluminum panels. The
drying time of the primer is an important
consideration in the manufacturing process. Twenty
panels are selected and the drying times are as
follows: 1.6, …
Is there evidence that the mean drying time of the
primer exceeds 1.5 hr?