You are on page 1of 33

Chapter 7

Hypothesis Testing Two


Populations
Week 10
L3: - Hypothesis Testing Between two means
(2 populations, variance unknown but not equal)
- Hypothesis Testing Between two means
(2 populations, variance unknown large samples)
- Hypothesis Testing- proportion
( 2 populations)
1
September 2013
Learning Objectives
At the end of the lesson student should be
able to
Carry out hypothesis testing for
difference in means for two normal
populations ( variances unknown)
Carry out hypothesis testing for
difference in means for difference in two
proportion


2
September 2013
Null Hypothesis is the same as before:
TWO VARIANCES ARE UNKNOWN AND UNEQUAL
Test about the difference
Test statistic:
) / ( ) / (
) ( ) (
2
2
2 1
2
1
2 1 2 1
n S n S
x x
T
+

=

Case 2:
2
2
2
1
o o =
But the degree of freedom is given by
v
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
v
If is not an integer, round down to the nearest integer.
v
0
2 1
=
3
Test about the difference
Case 2:
2
2
2
1
o o =
0
2 1
=
Critical region:
Alternative Hypothesis Rejection Criteria ( Reject H
0
)

TEST ABOUT TWO NORMAL MEANS
WHEN TWO VARIANCES ARE UNKNOWN
v v
t T or t T
, 2 / , 2 / o o
< >
2 1 1
: = H
v
t T
, o
>
2 1 1
: > H
v
t T
, o
<
2 1 1
: < H
4
September 2013
A two sided confidence interval for
when variance is unknown :
)% 1 ( 100 o
2 1

2
2
2
1
2
1
, 2 / 2 1
2 1
2
2
2
1
2
1
, 2 / 2 1
n
s
n
s
t x x
n
s
n
s
t x x
+ + s
s +
v o
v o

Confidence interval:
Case 2:

2
2
2
1
o o =
Value of is from the formula earlier
v
5
September 2013
6
Example 1:
Two companies manufacture a rubber material intended for use in
an automotive application. 25 samples of material from each
company are tested, and the amount of wear after 1000 cycles are
observed. For company 1, the sample mean and standard deviation
of wear are

and for company 2, we obtain
cycles 1000 / 9 . 1 and cycles 1000 / 12 . 20
1 1
mg s mg x = =
Do the sample data support the claim that the two companies
produce material with different mean wear? Assume each population
is normally distributed but unequal variances?
cycles 1000 / 9 . 7 and cycles 1000 / 64 . 11
2 2
mg s mg x = =
September 2013
7
2. State the null hypothesis H
0
and appropriate alternative
hypothesis, H
1
0 :
2 1 0
= H 0 :
2 1 1
= H
3. Determine the appropriate test statistic

) / ( ) / (
) ( ) (
2
2
2 1
2
1
2 1 2 1
n S n S
x x
T
+

=

1. Identify the parameter of interest
Parameter of interest; the difference between the true average
Variances unknown and unequal
2 1

September 2013
8
5. State the rejection region for the statistic

479 . 2 if H ject Re
0
> T
4. Critical value given o = 0.01

479 . 2
26 , 01 . 0 ,
= = t t
v o
2 2
2 2 2 2
1 2
1 2
2 2 2 2
2 2 2 2
1 2
1 2
1 2
(1.9) (7.9)
25 25
26.77
(1.9) (7.9)
25 25
24 24 1 1
26
s s
n n
s s
n n
n n
v
v
| | | |
+ +
| |
\ . \ .
= = =
| | | | | | | |
| | | |
\ . \ . \ . \ .
+ +

~
September 2013
9
7. Make a decision

Decision: since we reject H
0

Enough evidence to support that

479 . 2 22 . 5 > = T
2 1
=
6. Compute the value of the test statistic

22 . 5
25
) 9 . 7 (
25
) 9 . 1 (
0 ) 64 . 11 12 . 20 (
2 2
=
+

= T
September 2013
10
Exercise:
The following data represent the running times of films produced
by 2 motion-picture companies. Test the hypothesis that the
average running time of films produced by company 2 exceeds the
average running time of films produced by company 1 by 10
minutes against the one-sided alternative that the difference is less
than 10 minutes? Use o = 0.01 and assume the distributions of
times to be approximately normal with unequal variances.
Time
Company
X
1
102 86 98 109 92
X
2
81 165 97 134 92 87 114
September 2013
11
2. State the null hypothesis H
0
and appropriate alternative
hypothesis, H
1
10 :
1 2 0
> H 10 :
1 2 1
< H
3. Determine the appropriate test statistic

) / ( ) / (
) ( ) (
2
2
2 1
2
1
1 2 1 2
n S n S
x x
T
+

=

1. Identify the parameter of interest
Parameter of interest; the difference between the true average
Variances unknown and unequal
1 2

September 2013
12
5. State the rejection region for the statistic

998 . 2 if H ject Re
0
< T
4. Critical value given o = 0.01

998 . 2
7 , 01 . 0 ,
= = t t
v o
38 . 7
6 / ) 7 / 333 . 913 ( 4 / ) 5 / 8 . 78 (
) 7 / 333 . 913 5 / 8 . 78 (
1
) / (
1
) / (
) (
2 2
2
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
v
September 2013
13
7. Make a decision

Decision: since , we fail to reject H
0

Not enough evidence that

998 . 2 22 . 0 > = T
10
1 2
<
22 . 0
7 / 333 . 913 5 / 8 . 78
10 ) 4 . 97 110 (
) / ( ) / (
) ( ) (
2
2
2 1
2
1
1 2 1 2
=
+

=
+

=
n S n S
x x
T

6. Compute the value of the test statistic

September 2013
Test statistic:

Test about the difference between two means (Large Samples)
0
2
2
2
1
2
1
2 1 2 1
H under ) 1 , 0 ( ~
) ( ) (
N
n
S
n
S
x x
Z
+

=

Null Hypothesis:
vs
2 1 0
: = H
2 1 1 2 1 1 2 1 1
: or : or , : < > = H H H
Alternative Hypothesis Rejection Criteria ( Reject H
0
)

2 1 1
: = H
2 1 1
: > H
2 1 1
: < H
2 / 2 / o o
z Z or z Z < >
o
z Z >
o
z Z <
Case 3:
A confidence interval for is
)% 1 ( 100 o
2 1

2
2
2
1
2
1
2 / 2 1 2 1
2
2
2
1
2
1
2 / 2 1
n
S
n
S
z x x
n
S
n
S
z x x + + s s +
o o

The procedures used in hypothesis testing for 2 populations
are the same as in the hypothesis testing for one population.
Conclusion of the test could also be based on the confidence
Interval and the p-value.

September 2013
Example 3:

A study wants to investigate if the mean price of a new Proton car has
changed in 2012 compared to 2011. A sample of cars were taken during
these two years and summary information as given below:









i. Perform the test for the above investigation. What is your conclusion?
ii. Find the two sided 95% CI for the difference between the two means in
2011 and 2012. What is your conclusion comparing with part (i).


Year

2011

2012

Mean car price

RM 45,000

RM 48,000

Standard deviation of car
prices

RM 1,500

RM 2,000

Number of cars

150 200
September 2013
Solution
1. From the problem context, identify the parameter of interest
2 1

2. State the null hypothesis H
0
and appropriate alternative
hypothesis, H
1
2 1 0
: = H
2 1 1
: = H
3. Determine the appropriate test statistic

) / ( ) / (
) ( ) (
2
2
2 1
2
1
2 1 2 1
n S n S
x x
Z
+

=

To test the difference between the true average large sample
September 2013
6. Compute any necessary sample quantities, substitute these into
the equation for the test statistic, and compute the value

, 200 , 150 , 2000 , 1500 , 000 , 48 , 45000
2 1 2 1 2 1
= = = = = = n n S S X X
Compute the value of the test statistic:
04 . 16
) 200 / 2000 ( ) 150 / 1500 (
000 , 48 000 , 45
) / ( ) / (
) ( ) (
2 2
2
2
2 1
2
1
2 1 2 1
=
+

=
+

=
n S n S
x x
Z

Find the p - value

P-value =
0 ) 1 1 ( 2 )) 04 . 16 ( 1 ( 2 = = u
Since p-value < 0.05, we reject the null hypothesis. We conclude that the mean price
of car in 2012 has change significantly compared to 2011.
From formula:
2
2
2
1
2
1
2 / 2 1 2 1
2
2
2
1
2
1
2 / 2 1
) ( ) ( ) (
n
S
n
S
z x x
n
S
n
S
z x x + + s s +
o o

Find a 95% CI on the difference in means.
( ) ( )
200
2000
150
1500
96 . 1 48000 45000
200
2000
150
1500
96 . 1 48000 45000
2 2
2 1
2 2
+ + s s +
32 . 2633 67 . 3366
2 1
s s
Since
1

2
= 0 is not in the interval then we reject H
0
.
Both propellants are not the same mean burning rate.

September 2013
Exercise:

In a test to compare the effectiveness of two drugs designed
to lower cholesterol levels, 75 randomly selected patients
were given drug A and 100 randomly selected patients were
given drug B. Those given drug A reduced their cholesterol
levels by an average of 40mg with standard deviation 12mg,
and those given drug B reduced their cholesterol levels by an
average 42mg with standard deviation of 15mg.

i. Perform the test for the above investigation. Can you
conclude that the mean reduction using drug B is greater
than that of drug A?
ii. Find the two sided 95% CI for the difference between the
two means of reductions using drug A and drug B. What is
your conclusion comparing with part (i).


September 2013
TEST FOR TWO PROPORTIONS
Alternative Hypothesis Rejection Criteria ( Reject H
0
)

Null Hypothesis:
2 1 0
: p p H = ) : , : (or
2 1 0 2 1 0
p p H p p H > s
2 / 2 / o o
z Z or z Z < >
2 1 1
: p p H =
o
z Z >
2 1 1
: p p H >
2 1 1
: p p H <
o
z Z <

Test Problems about two proportions:
Test statistic:
2 1
2 1
2 1
2
2
2
1
1
1
n
1
n
1
2 1
p p when ) 1 , 0 ( N Z
n n
X X
p

,
n
X
p

,
n
X
p

;
) )( p

1 ( p

Z
2 1
= ~
+
+
= = =
+

=
21
A two sided confidence interval for is:
)% 1 ( 100 o
2 1
p p
UL p p LL
n
p p
n
p p
z p p UL
n
p p
n
p p
z p p LL
s s

+ =

=
2 1
2
2 2
1
1 1
2 / 2 1
2
2 2
1
1 1
2 / 2 1
)

1 (

1 (

)

(
)

1 (

1 (

)

(
o
o
Confidence interval:
22
September 2013
23
Solution
Step 1 Problem: Test about two proportions large samples
Step 2 H
0
: p
A
= p
B
H
1
: p
A
> p
B
Example 4:
In a study on the effects of sodium restricted diets on hypertension, 24
out of 55 hypertensive patients were on sodium restricted diets, and 36
out of 149 non-hypertensive patients were on sodium restricted diets.
i. Test the hypothesis that the proportion of patients on sodium
restricted diets is higher for hypertensive patients at a=0.05.
ii. What is the P-value for this test?
iii. Construct a two sided 95% CI and comment.

Step 3 Determine the appropriate test statistic

B A
B A
B
B
B
A
A
A
B A
B A
B A
n n
X X
p ,
n
X
p ,
n
X
p where
p p if N(0,1)
) )( p (1 p
p p
Z
n
1
n
1
+
+
= = =
= ~
+

=



24
Step 4 Critical value given o = 0.05,

z
o
= z
0.05
= 1.645
645 . 1 ject Re
0
> Z if H
Step 5 Rejection region for the statistic

Step 6 Compute the value of the test statistic:
29 . 0
149 55
36 24
where , 9455 . 4
149
1
55
1
) 30 . 0 1 ( 30 . 0
24 . 0 44 . 0
24 . 0 , 44 . 0 , 36 , 24 , 149 , 55
0
=
+
+
= =
|
.
|

\
|
+

=
= = = = = =
p z
p p x x n n
B A B A B A
September 2013
25
Step 7. Make a decision

Since z
0
> 1.65, then we reject H
0
. It means that enough
evidence to claim that the proportion of patients on
hypertension is higher than non hypertension patients
September 2013
26
Solution
Step 1 Problem: Test about two proportions large samples
Step 2 H
0
: p
1
= p
2
H
1
: p
1
> p
2
Example 5:
A vote is to be taken among residents of a town and the
surrounding county to determine whether a proposed chemical
plant should be constructed. If 120 of 200 town voters favour the
proposal and 240 of 500 county residents favour it, would you
agree that the proportion of town voters favouring the proposal is
higher than the proportion of county voters? Use o = 0.05
Step 3 Determine the appropriate test statistic

2 1
2 1
2
2
2
1
1
1
2 1
n
1
n
1
2 1
n n
X X
p ,
n
X
p ,
n
X
p where
p p if N(0,1)
) )( p (1 p
p p
Z
2 1
+
+
= = =
= ~
+

=



27
Step 4 Critical value given o = 0.05

z
o
= z
0.05
= 1.645
645 . 1 ject Re
0
> Z if H
Step 5 Rejection region for the statistic

Step 6 Compute the value of the test statistic:
500 , 200 , 240 , 120
2 1 2 1
= = = = n n X X
2 1
2 1
2
2
2
1
1
1
2 1
n
1
n
1
2 1
n n
X X
p ,
n
X
p ,
n
X
p where
p p if N(0,1)
) )( p (1 p
p p
Z
2 1
+
+
= = =
= ~
+

=



2.9
500 200
240 120
,
500
240
,
200
120

2 1
=
+
+
= = =
Z
p p p
September 2013
28
Step 7. Make a decision

Decision: since , we reject H
0
and agree
that the proportion of town voters favouring the
proposal is higher than the proportion of county voters.
645 . 1 9 . 2 > = Z
September 2013
TEST FOR TWO VARIANCES
Alternative Hypothesis Rejection Criteria ( Reject H
0
)

) :
or , :
or : vs :
2
2
2
1 1
2
2
2
1 1
2
2
2
1 1
2
2
2
1 0
o o
o o
o o o o
>
<
= =
H
H
H H
2
2
2
1 1
: o o = H
2
2
2
1 1
: o o < H
2
2
2
1 1
: o o > H

Test Problems about two variances:
Test statistic:
29
2
2
2
1
0
s
s
F =
1 , 1 , 2 / 1 0 1 , 1 , 2 / 0
2 1 2 1
or

< >
n n n n
f F f F
o o
1 , 1 , 0
2 1

<
n n
f F
o
1 , 1 , 0
2 1

>
n n
f F
o
September 2013
A two sided confidence interval for is:
)% 1 ( 100 o
2
2
2
1
o o
Confidence interval:
30
1 , 1 , 2 /
2
2
2
1
2
2
2
1
1 , 1 , 2 / 1
2
2
2
1
1 2 1 2

s s
n n n n
f
s
s
f
s
s
o o
o
o
September 2013
31
Solution
Step 1 Problem: Test about two population variances
Step 2

Example 6:
A random sample of 12 air pollution index at UTP station produced a
variance 0.0340 while a random sample of another 13 air pollution index
at Tronoh station produced a variance 0.0525.

i. Are the population variances equal?. Use a = 0.05.
ii. Find the 95% two-sided confidence interval on the ratio of two
variances.
Step 3 Determine the appropriate test statistic

2
2
2
1 1
2
2
2
1 0
: vs : o o o o = = H H
2
2
2
1
0
s
s
F =
September 2013
32
Step 4 Critical value a=0.05, f
a/2, 12,13
= 3.15
Step 5 Rejection region: Reject IF

Step 6 Compute the value of the test statistic:
32 . 0
15 . 3
1 1
or 15 . 3
13 , 12 , 025 . 0
13 , 12 , 975 . 0 0 13 , 12 , 025 . 0 0
= = = < = >
f
f F f F
0
H
648 . 0
0525 . 0
0340 . 0
2
2
2
1
0
= = =
s
s
F
Step 7. Make a decision

Since 0.32<F
0
< 3.15, then we cannot reject H
0
. It means that not
enough evidence to say that the variances of the two pollution
indexes are different.
September 2013
A 95% two sided confidence interval for is:
2
2
2
1
o o
Confidence interval:
33
041 . 2 206 . 0
) 15 . 3 (
0525 . 0
0340 . 0
15 . 3
1
0525 . 0
0340 . 0
1
2
2
2
1
2
2
2
1
1 , 1 , 2 /
2
2
2
1
2
2
2
1
1 , 1 , 2 /
2
2
2
1
1 , 1 , 2 /
2
2
2
1
2
2
2
1
1 , 1 , 2 / 1
2
2
2
1
1 2
1 2
1 2 1 2
s s
s s
s s
s s



o
o
o
o
o
o
o
o
o
o
o o
n n
n n
n n n n
f
s
s
f s
s
f
s
s
f
s
s
September 2013

You might also like