Sei sulla pagina 1di 69

HYPOTHESIS

TESTING
.

Steps in Hypothesis Testing - 1


State the hypothesis to be tested in terms of Ho and
Ha
State the significance level of the test ( )
Take sample of known size (n) and compute
parameter estimate (e.g.
)
x on the
Determine the test statistic - a statistic based
sample and whose distribution is known
e.g. for hypothesis about a mean ( ) the statistic may
be z or t

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

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. Ho
and Ha are:
Ho: = 70
Ha: 70
Note: Ho may be written always with an equality (=) sign
4

Test on a Single , Variance Know:


Test Statistics
We sample death records from 100 persons
and found
yr
x 71.8
Assume true s.d. is = 8.9 yr
The appropriate test statistic (T.S) is Z,
where

x o
Z
/of the
n hypothesized mean in
and o is value
Ho

Test on a Single , Variance Known:


Region of Rejection (R.R.) - 1
If Ho is true we would expect the sample
mean, x , 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 Ho is true
that is, we would reject Ho if the Z-value is large
(small) and conclude that > 70 or < 70
6

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 Ho
This error (Type I error) should have a
small probability ( ) of occurring
is usually set at .01 or .05 and is called
the significance

level of the test


7

Test on a Single , Variance Known:


Types I and II errors
= Pr (Type I error)
= Pr (rejecting Ho|Ho is true)
= Pr (Type II error)
= Pr (not rejecting Ho|Ho is false)
Power of the test =1-
8

Test on a Single , Variance Known:


Region of Rejection (R.R.) - 4
Ha: 70 is called a 2-sided alternative
This means that we can reject Ho if Z falls
in either the left or right side R.R.

So each R.R. has area = 2 , not

Test on a Single , Variance Known:


Region of Rejection (R.R.) - 5
To decide if Ho should be rejected we must
determine if the calculated Z (from x ) is
greater than Z or less than - Z
2

There are two ways of writing this:


R.R.: Reject Ho if | Z | > Z/2
OR
R.R.: Reject Ho if

Z Z

or

Z Z

2
10

Test on a Single , Variance Known:


All Steps
Ho (Null Hypothesis)
Ha (Alternative Hypothesis)
-value
T.S. (Test Statistic)
Region of Rejection (R.R.)
Decision
Conclusion
Note:
Ha may also be written as H1 and
R.R. may also be called Decision Rule (D.R.)
11

Test on a Single , Variance Known:


Example - 2

Ho: = 70
Ha: 70
Select = .05 arbitrarily (So Z 2 Z .025 1.96)
T.S.:
x
71.8 70

/ n

8.9 / 100

R.R.: Reject Ho if Z Z 2

2.02

or Z Z 2
12

Test on a Single , Variance Known:


Example - 2
Decision: We reject Ho, since Z(=2.02) >
Z.025(=1.96)
Conclusion: No evidence that the true
mean life span is 70 yr
Note: = .05 means that there is a 5%
chance of falsely rejecting Ho

13

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
Ho: = 70
Ha: > 70
This is called a 1-sided right-tail test
For this 1-sided test R.R. is different
R.R.: Reject Ho if Z > Z
All the error probability ( ) is now in the right tail
of the distribution
14

Test on a Single :
Variance Known - Right-Sided Test: Example
Ho: = 70 or 70
Ha: > 70
= .05
x
2.02
T.S.: Z

/ n

R.R.: reject Ho if Z > Z


Decision: We reject Ho since Z(=2.02) > Z.05(=1.645)
Conclusion: No evidence that the true mean is less than or
equal to 70 yr.
Note: For a 1-sided test Z = Z.05 = 1.645
15

Test on a Single :
Variance Known - Left-Sided Test
Suppose we wanted to test Ha: < 70;
then
Ho: = 70 or 70
Ha: < 70
= .05
x
Z
2.02
T.S.:

/ n

16

Test on a Single :
Variance Known - Left-Sided Test
R.R.: Reject Ho if Z < Z
Decision: We do not reject Ho since
Z(=2.02) not < Z.05(= -1.645)
Conclusion: No evidence that the true
mean is less than 70
Note: (- Z = -1.645)

17

Hypothesis Tests: General Comments


The R.R. depends on Ha and -value
The conclusion is related to Ha
We say Do not reject H0 instead of
Accept H0 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 H0
18

19

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

x
~ t n1
s/ n

20

Test on a Single :
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 x = 42
and s = 11.19 kilowatt-hours
21

Test on a Single :
Variance Unknown - Steps
Ho: = 46 or 40
Ha: < 46
= .05
T.S.:

x
42 46
t

1.16
s / n 11.9 / 12

R.R.: Reject Ho if t < t,n-1


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

not <

22

Test on a Single :
Variance Unknown - Steps
Conclusion: No evidence that the true
average energy expenditure is less than 46
kw-hr
Note: Because we are performing a
1-sided test (see Ha) all the error probability
is in one region (the left) of the distribution;
hence we use t , not t/2
23

Test on a Single :
Variance Unknown - Size of n
For the above t-test ( 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
from the large sample size (n
Z s-value

30) is written sas/ n


24

C.I. Approach to Hypothesis Testing


We can test Ho: = o vs Ho: o using
a C.I.
We replace the usual test static with the
(1 )% C.I.
Our Decision Rule (R.R.) is to reject Ho if
the C.I. does not contains zero

25

C.I. Approach to Hypothesis Testing:


Example
For the earlier 2-sided example
Ho: = 70
Ha: 70
= .05

8.9
71.8 1.96
T.S.: x Z 2
n
100
(70.06,72.54)
26

C.I. Approach to Hypothesis Testing:


Example
D.R.: Reject Ho if the C.I. does not
contain the hypothesized value
Dec.: Since 70.06 72.54 does not
contain 70.0, we reject Ho
Conclusion: No evidence that the true
mean is equal to 70

27

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)
2
2

variance, 1 and 2 . The 3 conditions are:


2
2

1. 1 and
2 are known
2
2
2
2

2. 1 and 2 unknown, but 1


2
2
2
2
2

3. 1 and 2 unknown, but 1


2

28

Test on ( 1 2) When
2
2
1 And 2 Are Known - 1
Consider a 2-sided test
Ho: 1 2 = do (do is a specified value)
Ha: 1 2 do
T.S.:

( x1 x2 ) d o

R.R.: Reject Ho if
(Note: do = ( 1 2)0

12
n1

22
n2

or

Z Z

Z Z

2
29

Test on ( 1 2) When
2
2
1 And 2 Are Known - 2
Recall that there can be 3 different Ha s and each
has a different R.R.
1. Ha: 1 2 do
R.R.: Reject Ho if
2. Ha: 1 2 > do
R.R.: Reject Ho if
3. Ha: 1 2 < do
R.R.: Reject Ho if

or

Z Z

Z Z

Z Z

Z Z

30

Difference in Means Hypothesis Test: s known


Problem 10.30 page 358
H 0 : 1 2 or

1 2 0

H a : 1 u 2 or u1 u 2 0

X
T .S . : Z

X 2 1 2 0

n1 n2

D.R. Rej H 0 ,if

2
1

2
2

81 76 0
2

5* 2 3* 4

25
36

5.85

Z Z 0.025

Dec. Rej H 0 ,since 5.85 >1.96


Conclusion. No evidence that the two population
means are equal.
31

Test on ( 1 2) When
2
2
1 And 2Are Known - Example
Work example 10.6, page 314

32

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

33

Test on ( 1 2)
2
2
When 1 and 2 are Unknown
2
2
and ( 1 2 ) - 2
S ( n1 1) S ( n2 1)
S
( n1 1) ( n2 1)
2
p

2
1

2
2

Since the are unknown the test


statistic is the t-statistic not the Z-statistic
2
i

34

Test on ( 1 2)
2
2
When 1 and 2 are Unknown
2
2
and ( 1 2 ) - 3

Consider a 2-sided test


Ho: 1 2 = do
Ha: 1 2 do
T.S.:
(x x ) d

sp

1
n1

n12

R.R.: Reject Ho if t t ,n n 2or


2

t t ,n1 n2 2
2

35

Test on ( 1 2)
2
2
When 1 and 2 are Unknown
2
2
and ( 1 2 ) - 4

The T.S. (t) was formed by replacing 12


2

and 2 of the known variance formula


2
by s p
The d.f. for t is the sum of the d.f.s for the
2 samples; i.e. (n11)+(n21) = n1+n22
One sided tests are done in the usual way
by modifying Ha and R.R.
36

P346
10.6

Test on ( 1 2)
2
2
When 1 and 2 are Unknown
2
2
and ( 1 2 ) - 1

Again use s12 and s22 but do not pool


them since they are not from a common
population variance
2
2

The T.S. is formed by replacing 1 and 2


2
2
s
s
in the known variance test by 1 and 2
T.S.:
( x1 x2 ) d o

S12
n1

S 22
n2
38

Test on ( 1 2)
2
2
When 1 and 2 are Unknown
and ( 12 22 ) - 2
The degree of freedom for this t-distribution
is not (n1+n22). It is (pronounced new),
where

( s / n1 s / n2 )
2
2
2
2
( s1 / n1 ) ( s2 / n2 )

n1 1
n2 1
2
1

2
2

39

Test on ( 1 2)
2
2
When 1 and 2 are Unknown
and ( 12 22 ) - 3
Consider a 2-sided test
Ho: 1 2 = do
Ha: 1 2 do
T.S.: t ( x1 x2 ) d o
S12
n1

S 22
n2

R.R.: Reject Ho if t t ,or t t ,


2

40

Paired t-test: Concepts - 1


Data are collected in pairs
e.g. strengths of right (x1i) and left (x2i) 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 41

Paired t-test: Concepts - 2


Instead of testing ( 1 2) we compute
the difference (x1i x2i) 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 2 unknown
42

Paired t-test: Steps


Consider a 2-sided test
Ho: d = do
Ha: d do
T.S.:

d do
t
Sd / n

R.R.: Reject Ho if t t ,n1or t t ,n1


2

43

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 (x2) and
30 minutes after capture (x1) are taken
(x2i x1i) = di are computed for i = 1 to 15
d 9.848 and sd = 18.474

44

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

d 0
9.848 0

2.06
sd n 18.474 / 15

R.R.: Reject Ho if

t (=2.06) > t.025,14 or t < t.025,14


45

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 Ho

Conclusion: The androgen levels at


capture and after 30 minutes are not
significantly different
46

PAIRED T-Test
(example 2)
Q: Weight loss program
n=10 participants
X1

Starting
Weight

210

240

150

190

200

150

180

185

X2

Ending
Weight

200

180

155

200

150

140

170

168

Determine if the program was effective


Find di = x1-x2

PAIRED T-TEST (eg. 2)


X1

Starting
Weight

210

240

150

190

200

150

180

185

X2

Ending
Weight

200

180

155

200

150

140

170

168

di

Weight
lost

10

60

-5

-10

50

10

10

17

x
Find d , find Sd, like solving
for

H0: d = 0
Ha: d 0
T.S. t=

d 0
Sd / n

Continue as for any other t-test

, Sx

Test on / : Example
2
1

2
2

We would like to test if the variances


from two normal populations are equal
2
2
( 1 / 2 1 )
Samples of size n1 = 21 and n2 = 25 gave

s 3.84 and s 4.54


2
1

2
2

49

Test on / : Example
2
1

2
2

Ho: / 1 or
Ha: / 1 or
= .05
2
T.S.:
s1
Fo 2 3.84 / 4.54 0.85
s2
2
1
2
1

2
2
2
2

2
1
2
1

2
2
2
2

50

Test on / : Example
2
1

2
2

D.R.: Reject Ho 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 Ho
Conclusion: The variance of the two
populations are not significantly different
51

Test on / : Comments
2
1

2
2

F1 is the F value with area 1 2 to its right


2
Table for F-distribution are usually given for
small -values; e.g. 0.10, 0.05, 0.01, etc.
So if we need, say, F.95,10,12 (i.e. F1 ,10 ,12)
then we use

F.95 ,10,12

1
F.05,12,10
52

.
.

53

Large Sample Test on a Proportion (p)


x
pq
2
, p p, p
Recall: p
n
n
For large samples p
~ ND( p, pq
n )

An approximate test statistic is therefore

p po
po qo / n

or

x npo
Z
npo qo

Since p is unknown it cannot be used in the


Z-statistic. Instead we substitute the
hypothesized value (po)
54

Large Sample Test on p


- Steps
Consider a 2-sided test
Ho: p = po
Ha: p po
T.S.:

p po
po qo / n

R.R.: Reject Ho if Z Z or
2

Z Z

2
55

Large Sample Test on (p1 p2)


1 and p 2
For 2 sample proportions p

p 1 p 2 p1 p2
p1q1 p2q2
2
p 1 p 2

n1
n2
1 p 1 ) ~ ND
When samples are large ( p
A suitable T.S. is therefore

( p 1 p 2 ) ( p1 p2 )o
p1q1
n1

p2q2
n2
56

Large Sample Test on (p1 p2)


Since p1, p2 , q1 and q2 are unknown we
substitute the sample values but we pool
the samples to get a pooled p and q

x1 x2
p
n1 n2

57

Large Sample Test on (p1 p2): Steps


Consider a 2-sided test
Ho: (p1p2) = (p1p2)o
Ha: (p1p2) (p1p2)o
where (p1p2) is a hypothesised value
T.S.:

( p1 p2 ) ( p1 p2 )o
Z
1
1

p
q
(

)
n
n
R.R.: Reject H if
1 or 2
o

Z Z

Z Z

58

Test on a Single Variance ( 2)


The objective is to test if 2 is of a certain
value ( 2)
o
We estimate 2 from a sample (S2)
Since the distribution of S2 is unknown, we
convert it to 2

( n 1) S /
2

2
o

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


59

Test on a Single Variance ( 2): Steps


Consider a 2-sided test
Ho: 2 2
o
2
2
Ha:

= .05
where
T.S.:

is
a specified value
2

(
n

1
)
S
/

R.R.: Reject H if
2

2
o or

,n1
2

2
2

2
1 2 ,n1
60

Test on 2: Comments
2 is always positive, so the left-tail critical
2

region is 1
2
2
2
1 .975 for = .05
2
2
.975 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
61

Test on Two Variances ( / )


2
1

2
2

The objective is to compare the variances of


two populations
If the two populations are normal then

S /
S /
2
1
2
2

2
1
2
2

~ Fn1 1,n2 1

If we assume
12 ) as in
2
2(i.e.
21 2
2 1

Ho, Sthen
and2 can be used
1
F S2
as a test statistic2for this test
62

Test on Two Proportions ( / )Steps


2
1

2
2

Consider a 2-sided test


2
2
2
2
Ho: 1 / 2 ( 1 / 2 )0
2
2
2
2
Ha: 1 / 2 ( 1 / 2 )0
2
S
T.S.: F 1
2
S2
R.R.: Reject Ho if F F2 ,n1 1,n2 1 or

F F1 ,n1 1,n2 1
2

63

.
.

64

Test of Independence
0 lights

1 light

2 lights

3 lights

4 lights

Sums

Morning

20

65

64

159

Afternoon

12

20

75

72

187

Night

10

10

16

10

54

Sums

22

26

50

156

146

400

The table indicates the number of times a certain amount of traffic lights were stopped at (0,1,2,3,
or 4) by a vehicle on a workday within a small city. The data are for 400 vehicles. Let L = the
number of lights stopped at by a vehicle. The 2 factors (variables) are number of lights and time.
The question: Does the number of lights stopped at depend on the time.
Calculations: The above are the observed frequencies (Oi). Find the expected frequencies (Ei) for
each cell from Ei=ni*nj/n; e.g. For the first cell Ei = 22*159/400.
Now compare Ei and Oi using the Chi-square statistic as done in goodness of fit tests.

GOODNESS OF FIT HYPOTHESIS TEST


Given the following frequency distribution for the battery life
data determine if battery life (X) follows a normal distribution.

X
1.45 x 1.95

1.95 x 2.45
2.45 x 2.95
2.95 x 3.45

f i Oi
2
1
4
15

3.45 x 3.95

10

3.95 x 4.45

4.45 x 4.95

3
40
66

Calculation of pi
Calculate pi as follows:
P(1.45<x<1.95)
1.45
1.95
=P(
<Z<

) = 0.0125

67

f i Oi

pi

Ei

Oi Ei 2 / Ei

1.45 x 1.95

0.0125

0.5

7 8 .5 2 / 8 . 5

1.95 x 2.45

0.0525

2.1

2.45 x 2.95

5.9

2.95 x 3.45

15

10.3

15 10.3 2 / 10.3

3.45 x 3.95

10

10.7

10 10.7 2 / 10.7

3.95 x 4.45

7.0

8 10.5 2 / 10.5

4.45 x 4.95

3.5

3.05 2

40

If at least 80% of the E i s are not


Oi Ei 2 2 3.05
Thus,
Ei

5 then combine classes.


68

Goodness of Fit Hypothesis Test

H 0 : xi ~ ND 3.5; 2 0.72

H a : xi not ~ ND

T . S . : 2 Oi Ei 2 / Ei 3.05
2
2

D.R. : Reject H o if
k p 1

(k-p-1=4-2-1=1)

Decision: Since 3.05 < 3.841 do not reject H o


Conclusion: No evidence that data( xi )comes from a
normal distribution with mean = 3.5 and
variance = 0.72

69

Potrebbero piacerti anche