Вы находитесь на странице: 1из 63

1

IE 5351

HYPOTHESIS
TESTING
.
2





Reference Textbook



Probability and Statistics for
Engineers and Scientists
by
Walpole, Myers and Myers
7
th
edition
3
DEFINITION
A statistical hypothesis is an assertion
about the (unknown) parameter of a
population that you believe to be true

It should not be a blind guess but should have
some objective basis

Example: The average mpg of all small cars
made by GM is over 32 mpg.
4
Steps in Hypothesis Testing - 1
State the hypothesis to be tested in terms of
H
o
and H
a

State the significance level of the test (o)
Take sample of known size (n) and
compute parameter estimate (e.g. )
Determine the test statistic - a statistic
based on the sample and whose
distribution is known
e.g. for hypothesis about a mean () the
statistic may be z or t
x
5
Steps in Hypothesis Testing - 2
Determine the criterion for rejecting the
null hypothesis (region of rejection, R.R.,
or decision rule)
Make a decision based on the criterion
Make a conclusion
6
Test on a Single , Variance Known:
Hypothesis
See example 10.4
We would like to test the research hypothesis
that the mean human life span is not 70 yr. H
o

and H
a
are:
H
o
: = 70
H
a
: = 70
Note: H
o
may be written always with an equality (=) sign
7
Test on a Single , Variance Know:
Test Statistics
We sample death records from 100
persons and found yr
Assume true s.d. is o = 8.9 yr
The appropriate test statistic (T.S) is Z,
where

and
o
is value of the hypothesized mean
in H
o

8 . 71 = x
n
x
Z
o
/ o

=
8
Test on a Single , Variance Known:
Region of Rejection (R.R.) - 1
If H
o
is true we would expect the sample
mean, , to be equal or close to
o
(
o
= 70)
that is, we would expect Z to be equal to or close
to 0 (zero)
The probability of obtaining a large or small
Z-value is therefore low if H
o
is true
that is, we would reject H
o
if the Z-value is large
(small) and conclude that > 70 or < 70
x
9
Test on a Single , Variance Known:
Region of Rejection (R.R.) - 2
How large the Z-value should be for
rejection is arbitrarily set by a
reasonably low error of falsely rejecting
H
o

This error (Type I error) should have a
small probability (o) of occurring
o is usually set at .01 or .05 and is called
the significance level of the test
10
Test on a Single , Variance Known:
Region of Rejection (R.R.) - 4
H
a
: = 70 is called a 2-sided alternative
This means that we can reject H
o
if Z falls
in either the left or right side R.R.
So each R.R. has area = , not o
2
o
11
Test on a Single , Variance Known:
Region of Rejection (R.R.) - 5
To decide if H
o
should be rejected we
must determine if the calculated Z
(from ) is greater than or
less than -

R.R.: Reject H
o
if or
x
2
o
Z
2
o
Z Z >
2
o
Z Z <
2
o
Z
12
Test on a Single , Variance Known:
All Steps
H
o
(Null Hypothesis)

H
a
(Alternative Hypothesis)
o-value
T.S. (Test Statistic)
Region of Rejection (R.R.)
Decision
Conclusion
Note:
H
a
may also be written as H
1
and
R.R. may also be called Decision Rule (D.R.)
13
Test on a Single , Variance Known:
Example - 2
H
o
: = 70
H
a
: = 70
Select o = .05 arbitrarily (So
T.S.:


R.R.: Reject H
o
if or
) 96 . 1
025 .
2
= = Z Z
o
02 . 2
100 / 9 . 8
70 8 . 71
/
=

=
n
x
Z
o
o

2
o
Z Z >
2
o
Z Z <
14
Test on a Single , Variance Known:
Example - 2
Decision: We reject H
o
, since Z(=2.02) >
Z
.025
(=1.96)
Conclusion: The mean life span is
significantly different from 70
Note: o = .05 means that there is a 5%
chance of falsely rejecting H
o

15
Test on a Single , Variance Known:
Right-Sided Test
Suppose we are sure that can t be < 70
and therefore test only > 0; that is
H
o
: = 70
H
a
: > 70
This is called a 1-sided right-tail test
For this 1-sided test R.R. is different
R.R.: Reject H
o
if Z > Z
o

All the error probability (o) is now in the
right tail of the distribution
16
Test on a Single :
Variance Known - Right-Sided Test: Example
H
o
: = 70
H
a
: > 70
o = .05
T.S.:

R.R.: reject H
o
if Z > Z
o

Decision: We reject H
o
since Z(=2.02) >
Z
.05
(=1.645)
Conclusion: No evidence that the true mean is
less than 70 yr



02 . 2
/
=

=
n
x
Z
o

17
Test on a Single :
Variance Known - Left-Sided Test
Suppose we wanted to test Ha: < 70;
then
H
o
: = 70
H
a
: < 70
o = .05
T.S.:
02 . 2
/
=

=
n
x
Z
o

18
Test on a Single :
Variance Known - Left-Sided Test
R.R.: Reject H
o
if Z < Z
o

Decision: We do not reject H
o
since
Z(=2.02) not < Z
.05
(= -1.645)
Conclusion: No evidence that the true
mean is less than 70
Note: (- Z
o
= -1.645)

19
Hypothesis Tests: General Comments
The R.R. depends on H
a
and o-value
The conclusion is related to H
a
We say Do not reject H
0
instead of
Accept H
0
because our Type II error
may be large. If we computed the Type II
error probability (|) and found it to be
small then we can say Accept H
0

20
21
Test on a Single :
o
2
Unknown
If o is unknown, we use its estimate, s, from
the sample
The test statistic becomes
Because of s this statistic is not
Z-distributed. It has a student-t distribution
with (n-1) degrees of freedom


n s
x
t
/

=
1
~
/

n
t
n s
x
22
Test on a Single :
o
2
Unknown - Example
We wish to test a research (alternative)
hypothesis that the mean energy
consumption per home is less than 46
kilowatt-hours ( < 46)
The energy consumption, X, is ND
A sample of n = 12 homes gave = 42
and s = 11.19 kilowatt-hours

x
23
Test on a Single :
Variance Unknown - Steps
H
o
: = 46
H
a
: < 46
o = .05
T.S.:

R.R.: Reject H
o
if t < t
o,n-1

Decision: Since t (= -1.16) is
not < t
o,n-1
(-1.796) we do not reject H
o



16 . 1
12 / 9 . 11
46 42
/
=

=
n S
x
t

24
Test on a Single :
Variance Unknown - Steps
Conclusion: Conclusion: No evidence that
the average energy expenditure is
significantly less than 46 kw-hr

Note: Because we are performing a 1-
sided test (see H
a
) all the error
probability is in one region (the left) of
the distribution; hence we use t
o
, not t
o/2

25
Test on a Single :
Variance Unknown - Size of n
For the above t-test (o unknown) we may
use the Z-test as an approximation when
n > 30. This is a consequence of the
Central Limit Theorem
The T.S. for the Z-approximation is


where the s-value from the large sample
size (n > 30) is written as o
n s
x
Z
/

=
26
C.I. Approach to Hypothesis Testing
We can test H
o
: =
o
vs H
o
: =
o
using
a C.I.
We replace the usual test static with the
(1o)% C.I.
Our Decision Rule (R.R.) is to reject H
o
if
the C.I. does not contains zero
27
C.I. Approach to Hypothesis Testing:
Example
For the earlier 2-sided example
H
o
: = 70
H
a
: = 70 o = .05

T.S.:

100
9 . 8
96 . 1 8 . 71
2
=
n
Z x
o
o
) 54 . 72 , 06 . 70 ( =
28
C.I. Approach to Hypothesis Testing:
Example
D.R.: Reject H
o
if the C.I. does not
contain zero
Dec.: Since 70.06 72.54 does not contain
zero we reject H
o

Conclusion: No evidence that the true
mean is equal to 70
29
Test on Two Variances ( )
The objective is to compare the variances
of two populations
If the two populations are normal then


If we assume (i.e. ) as in
H
o
, then and can be used as a test
statistic for this test
2
2
2
1
/ o o
1 , 1
2
2
2
2
2
1
2
1
2 1
~
/
/
n n
F
S
S
o
o
2
2
2
1
o o = 1
2
2
2
1
=
o
o
2
2
2
1
S
S
F =
30
Test on Two Proportions ( )-
Steps
Consider a 2-sided test
H
o
:
H
a
:
T.S.:

R.R.: Reject H
o
if or
2
2
2
1
/ o o
0
2
2
2
1
2
2
2
1
) / ( / o o o o =
0
2
2
2
1
2
2
2
1
) / ( / o o o o =
2
2
2
1
S
S
F =
1 , 1 ,
2 1
2

>
n n
F F
o
1 , 1 , 1
2 1
2

<
n n
F F
o
31
Test on : Comments
is the F value with area to its right
Table for F-distribution are usually given for
small o -values; e.g. 0.10, 0.05, 0.01, etc.
So if we need, say, F
.95,10,12
(i.e. )
then we use
2
2
2
1
/ o o
2
1
o

F
2
1
o

12 , 10 , 1
2
o

F
10 , 12 , 05 .
12 , 10 , 95 .
1
F
F =
32
Test on : Example
We would like to test if the variances
from two normal populations are equal
( )
Samples of size n
1
= 21 and n
2
= 25 gave
and
2
2
2
1
/ o o
1 /
2
2
2
1
= o o
84 . 3 s
2
1
= 54 . 4 s
2
2
=
33
Test on : Example
H
o
: or
H
a
: or
o = .05
T.S.:

2
2
2
1
/ o o
1 /
2
2
2
1
= o o
85 . 0 54 . 4 / 84 . 3
s
s
F
2
2
2
1
o
= = =
2
2
2
1
o o =
1 /
2
2
2
1
= o o
2
2
2
1
o o =
34
Test on : Example
D.R.: Reject H
o
if F(=0.85) > F
.025,20,24
(=2.33)
or F > F
.975,20,24
(=.415)
Decision: Since 0.85 not > 2.33
and 0.85 not < .415
we do not reject H
o

Conclusion: No evidence that the variance of
the two populations are significantly different
2
2
2
1
/ o o
35

36
Test on the Difference in
Two Means (
1

2
)
Consider two independent normal
populations. A test on the two means (e.g.

1

2
) uses either of 3 test statistics depending
on what we know about the true (population)
variance, and . The 3 conditions are:
1. and are known
2. and unknown, but
3. and unknown, but
2
1
o
2
1
o
2
1
o
2
2
o
2
2
o
2
2
o
2
2
2
1
o o =
2
2
2
1
o o =
Test on the Difference in
Two Means (
1

2
)
2
1
o
2
2
o
37
Test on (
1

2
) When
And Are Known - 1
Consider a 2-sided test
H
o
:
1

2
= d
o
(d
o
is a specified value)
H
a
:
1

2
= d
o

T.S.:


R.R.: Reject H
o
if or

2
1
o
2
2
o
2
o
Z Z >
2
o
Z Z <
2
2
2
1
2
1
) (
2 1
n n
o
d x x
Z
o o
+

=
38
Test on (
1

2
) When
And Are Known - 2
Recall that there can be 3 different H
a
s
and each has a different R.R.
1. H
a
:
1

2
= d
o

R.R.: Reject H
o
if or
2. H
a
:
1

2
> d
o

R.R.: Reject H
o
if
3. H
a
:
1

2
< d
o

R.R.: Reject H
o
if

2
o
Z Z >
2
o
Z Z <
o
Z Z >
o
Z Z <
2
1
o
2
2
o
39
Test on (
1

2
) When
And Are Known - Example
Work example in text book
2
1
o
2
2
o
40




END OF TOPIC


.
41
ATTENTION STUDENTS
Slides beyond this points may ve
studied after taking IE 5317. They
are useful for all IEs and system
engineers
42
Test on (
1

2
)
When and are Unknown
and - 1
For unknown we must use the sample
estimates and
When , the common variance is
o
2
;
We must use the sample estimate of o
2
(i.e. )
This is computed as a pooled variance from the
two samples

2
1
o
2
2
o
) (
2
2
2
1
o o =
2
1
o
2
2
s
2
1
s
2 2
2
2
1
o o o = =
2
2
2
1
o o =
2
p
s
43
Test on (
1

2
)
When and are Unknown
and - 2



Since the are unknown the test
statistic is the t-statistic not the Z-statistic
2
1
o
2
2
o
) (
2
2
2
1
o o =
2
i
o
) 1 ( ) 1 (
) 1 ( ) 1 (
2 1
2
2
2 1
2
1
2
+
+
=
n n
n S n S
S
p
44
Test on (
1

2
)
When and are Unknown
and - 3
Consider a 2-sided test
H
o
:
1

2
= d
o

H
a
:
1

2
= d
o

T.S.:


R.R.: Reject H
o
if or

2
1
o
2
2
o
) (
2
2
2
1
o o =
2 1
1 1
2 1
) (
n n p
o
s
d x x
t
+

=
2 ,
2 1
2
+
>
n n
t t
o
2 ,
2 1
2
+
<
n n
t t
o
45
Test on (
1

2
)
When and are Unknown
and - 4
The T.S. (t) was formed by replacing
and of the known variance formula
by
The d.f. for t is the sum of the d.f.s for the
2 samples; i.e. (n
1
1)+(n
2
1) = n
1
+n
2
2
One sided tests are done in the usual way
by modifying H
a
and R.R.
2
1
o
2
2
o
) (
2
2
2
1
o o =
2
1
o
2
2
o
2
p
s
46
Test on (
1

2
)
When and are Unknown
and - 1
Again use and but do not pool
them since they are not from a common
population variance
The T.S. is formed by replacing and
in the known variance test by and
T.S.:
2
1
o
2
2
o
) (
2
2
2
1
o o =
2
2
s
2
1
s
2
1
o
2
2
o
2
1
s
2
2
s
2
2
2
1
2
1
) (
2 1
n
S
n
S
o
d x x
t
+

=
47
Test on (
1

2
)
When and are Unknown
and - 2
The degree of freedom for this t-distribution
is not (n
1
+n
2
2). It is u, where
2
1
o
2
2
o
) (
2
2
2
1
o o =
1
) / (
1
) / (
) / / (
2
2
2
2
2
1
2
1
2
1
2
2
2
2 1
2
1

+
=
n
n S
n
n S
n S n S
u
48
Test on (
1

2
)
When and are Unknown
and - 3
Consider a 2-sided test
H
o
:
1

2
= d
o

H
a
:
1

2
= d
o

T.S.:


R.R.: Reject H
o
if or
2
1
o
2
2
o
) (
2
2
2
1
o o =
2
2
2
1
2
1
) (
2 1
n
S
n
S
o
d x x
t
+

=
u
o
,
2
t t >
u
o
,
2
t t <
49
Paired t-test: Concepts - 1
Data are collected in pairs
e.g. strengths of right (x
1i
) and left (x
2i
) hands in
people
The two sets of data are not independent
The objective of the test is to compare the
effects of the two conditions that comprise the
pairs
e.g. to determine if the right hand is stronger than
the left hand
e.g. to determine if peoples average weight before
dieting for a week is greater than after dieting
50
Paired t-test: Concepts - 2
Instead of testing (
1

2
) we compute the
difference (x
1i
x
2i
) for each pair and
then test the mean of the difference,
d

The differences are therefore tested as if
they are one sample of observations
This test is therefore like the one sample
(t-test) on a single with o
2
unknown
51
Paired t-test: Steps
Consider a 2-sided test
H
o
:
d
= d
o

H
a
:
d
= d
o

T.S.:


R.R.: Reject H
o
if or

n S
d
t
d
o d

=

1 ,
2

>
n
t t
o
1 ,
2

<
n
t t
o
52
Paired t-test:
Example - Data
See example 10.7, page 316
We want to test whether androgen level in
deer blood after 30 minutes of capture is
different from the level at time of capture
Data on 15 deers at time of capture (x
2
) and
30 minutes after capture (x
1
) are taken
(x
2i
x
1i
) = d
i
are computed for i = 1 to 15
and s
d
= 18.474

848 . 9 = d
53
Paired t-test:
Example - Test
H
o
:
d
= 0
H
a
:
d
= 0
o = .05
T.S.:

R.R.: Reject H
o
if
t (=2.06) > t
.025,14
or t < t
.025,14


06 . 2
15 / 474 . 18
0 848 . 9
0
=

=
n S
t
d
d

54
Paired t-test: Example- Test
Decision: Since
2.06 not > 2.145 (t
.025,14
) and
- 2.06 not < -2.145
we do not reject H
o

Conclusion: The androgen levels at
capture and after 30 minutes are not
significantly different
55
Large Sample Test on a Proportion (p)
Recall:
For large samples
An approximate test statistic is therefore


Since p is unknown it cannot be used in
the Z-statistic. Instead we substitute the
hypothesized value (p
o
)
n
pq
p
n
x
p
p p
= = =
2

, ,

o
) , ( ~

n
pq
p ND p
n q p
p p
Z
o o
o
/


=
o o
o
q np
np x
Z

=
or
56
Large Sample Test on p
- Steps
Consider a 2-sided test
H
o
: p = p
o

H
a
: p = p
o

T.S.:


R.R.: Reject H
o
if or
2
o
Z Z >
2
o
Z Z <
n q p
p p
Z
o o
o
/


=
57
Large Sample Test on (p
1
p
2
)

For 2 sample proportions and



When samples are large
A suitable T.S. is therefore
1

p
2

p
2 1

2 1
p p
p p
=

2
2 2
1
1 1
2

2 1
n
q p
n
q p
p p
+ =

o
ND p p ~ )

(
1 1

2
2 2
1
1 1
) ( )

(
2 1 2 1
n
q p
n
q p
o
p p p p
Z
+

=
58
Large Sample Test on (p
1
p
2
)
Since p
1
, p
2 ,
q
1 and
q
2
are unknown we
substitute the sample values but we pool
the samples to get a pooled and
p

2 1
2 1

n n
x x
p
+
+
=
59
Large Sample Test on (p
1
p
2
): Steps
Consider a 2-sided test
H
o
: (p
1
p
2
) = (p
1
p
2
)
o

H
a
: (p
1
p
2
) = (p
1
p
2
)
o
where (p
1
p
2
) is a hypothesised value
T.S.:


R.R.: Reject H
o
if or

) (

) ( ) (
2 1
1 1
2 1 2 1
n n
o
q p
p p p p
Z
+

=
2
o
Z Z >
2
o
Z Z <
60
Large Sample Test on (p
1
p
2
): Example
Work example 10.12
61
Test on a Single Variance (o
2
)
The objective is to test if o
2
is of a certain
value ( )
We estimate o
2
from a sample (S
2
)
Since the distribution of S
2
is unknown,
we convert it to _
2


where the _
2
has (n-1) degrees of freedom

2
o
o
2 2 2
/ ) 1 (
o
S n o _ =
62
Test on a Single Variance (o
2
): Steps
Consider a 2-sided test
H
o
:
H
a
:
o = .05

where is a specified value
T.S.:

R.R.: Reject H
o
if or
2 2
o
o o =
2 2
o
o o =
2
o
o
2 2 2
/ ) 1 (
o
S n o _ =
2
1 ,
2
2

>
n
o
_ _
2
1 , 1
2
2

<
n
o
_ _
63
Test on o
2
: Comments
_
2
is always positive, so the left-tail critical
region is
for o = .05
is the _
2
value with area .975 to its
right
This _
2
test is for a single population
variance. For comparing 2 population
variances, we use the F-test


2
1
2
o
_

2
975 .
2
1
2
_ _
o
=

2
975 .
_

Вам также может понравиться