You are on page 1of 15

STA 1502: TUTORIALS ON

DIFFERENCE BETWEEN 2 MEANS

Introduction
Twogroups of people, male and female. We want to
compare their average weekly spending.
Two airline companies flying the same routes. We want to
compare their average delay time.
We want to see if a training program is successful by
comparing the test scores before and after the program.
We want to compare the height between husbands and
wives
STA 1502: TUTORIALS ON DIFFERENCE
BETWEEN 2 MEANS

Independent samples with known variances


Interested in knowing if 1 2 or 1 2 0
.
We use x1 x2 to estimate 1 2 .

If X 1 N 1 , 1 and X 2 N 2 , 2
And X 1 and X 2 are independent.
12 22
Then ( x1 x2 ) N (1 2 ),
n1 n2

12 22
( x1 x2 ) N (1 2 ),
n1 n2

12 22
Confidence interval for 1 2 is ( x1 x2 ) Z 2
n1 n2

( x1 x2 ) (1 2 )
The test statistic is z
12 22

n1 n2
Example:
Periodically, coupons that can be used to purchase products at discount prices
appear in local newspapers. A supermarket chain has two different types of
coupon for its own brand of bread. Coupon 1 offers two loaves for the price of
one, and coupon 2 offers a 25 cent discount on the purchase of each loaf. In
order to determine the relative selling power of the two plans, the supermarket
chain performs the following experiment. The coupons appear in four
consecutive weeks (coupon 1 in weeks 1 and 2, and coupon 2 in weeks 3 and 4)
in local newspaper. The company wants to estimate the average daily sales
under each coupon plan. The average number of loaves sold per day during the
first 14 days was 153. The average number per day during the second 14 days
was 142. Assume that the number of loaves sold per day is normally distributed
with standard deviations 1 2 10 , determine whether the average daily
sales are the same under each coupon plan.
We are interested in comparing if 1 2
Assume 1 2 10
And x1 153 x2 142
n1 14 n2 14
Two ways of comparing.

1. The confidence interval for 1 2

95% confidence interval for 1 2


12 22
( x1 x2 ) Z 0.025
n1 n2
102 102
(153 142) 1.96
14 14
3.5919 to 18.4081

Since this interval does not include zero, we can conclude


that the two means are not equal.
2. Hypothesis test
H 0 : 1 2 or 1 2 0 H 0 : 1 2 0
H1 : 1 2 or 1 2 0 H1 : 1 2 0
( x1 x2 ) (1 2 )
z
*

12 22

n1 n2
2.9103
The critical value is
The critical value is 1.96 (two
1.645 (One sided), so
sided). So we conclude that the
conclude that mean for
means are different.
coupon 1 is bigger than
mean for coupon 2.
Unknown unequal variances
If X1 and X2 are normal or n1 and n2 are large

( X 1 X 2 ) ( 1 2 )
~ t( df )
2 2
s s
1
2
n1 n2

where df
s 2
1 n1 s n2
2 2
2
2 2
The Excel tool
calculates this
s n1 n2
2 4 2 4
s automatically, so you

1 2

n1 1 n2 1 don't need to use


this formula.
EXAMPLE

The SureStep Company manufactures high-quality treadmills for use in exercise


clubs. SureStep currently purchases its motors for these treadmills from supplier A.
However, it is considering a change to supplier B, which offers a slightly lower
cost. The question is whether supplier Bs motors are as reliable as supplier As. To
check this, SureStep installs motors from supplier A on 30 of its treadmills and
motors from supplier B on another 30 of its treadmills. It then run these treadmills
under typical conditions and, for each treadmill, records the number of hours until
motor fails.
MOTORS.XLS
A B C D
1 Differences between treadmill motors
2
3 Sample data (hours until motor fails)
4
5 Supplier A Supplier B
6 1358 658
7 793 404
8 587 735
9 608 457
10 472 431
11 562 658
25 462 456
35 666 507
36
H0 : A B 1
A B C D
t-Test: Two-Sample Assuming Unequal Variances
2
H1 : A B 3 Supplier A Supplier B
4 Mean 748.8 655.6667

( x A xB ) ( A B )
5 Variance 80588.58 67592.71

t
* 6 Observations 30 30
7 Hypothesized Mean Difference 0
s12 s22 8 df 58
9
10
t Stat
P(T<=t) one-tail
1.325162
0.095157
n1 n2 11 t Critical one-tail 1.671553
12 P(T<=t) two-tail 0.190314
13 t Critical two-tail 2.001716
14

Decision Rule: reject H0 if p-value < (0.05)

p-value = 0.190314 (Entry 12 in the excel


output)
As the p-value > , we fail to reject H0 and
we conclude there is enough evidence to
infer that the 2 means are the same.
A B C D
1 t-Test: Two-Sample Assuming Unequal Variances
2
3 Supplier A Supplier B
4 Mean 748.8 655.6667
5 Variance 80588.58 67592.71
6 Observations 30 30
7 Hypothesized Mean Difference 0
8 df 58
9 t Stat 1.325162
10 P(T<=t) one-tail 0.095157
11 t Critical one-tail 1.671553
12 P(T<=t) two-tail 0.190314
13 t Critical two-tail 2.001716
14

The 95% confidence interval on the mean difference is:

s12 s22
( x1 x2 ) t 2,df
n1 n2
93.133 2.0017 70.2807
47.5479 to 233.8139
Unknown equal variance

If X1 and X2 are normal or n1 and n2 are large

( X 1 X 2 ) ( 1 2 )
~ t( df )
1 1
sp
n1 n2
where df n1 n2 2

( n1 1) s ( n2 1) s
2 2
and s
2 1 2
n1 n2 2
p

(pooled variance estimate)


Example
Many companies are now installing EXERCISE.XLS
exercise facilities at their plants. The goal A B C D
is to make the employees more productive 2
3 Employee Exercise Rating
by getting them in better shape. One such 4 1 1 15
company installed exercise equipment on 5 2 1 17
6 3 1 16
site a year ago. To check whether it is 7 4 1 20
having a beneficial effect on employee 8 5 1 20
9 6 1 14
productivity, the company has gathered 10 7 1 14
data on 80 randomly chosen 11 8 1 16
74 71 0 10
employee,The comparison was based 75 72 0 13
on the employees productivity over the 76
77
73
74
0
0
9
15
year, as rated by their supervisors. Each 78 75 0 19
rating was on a scale of 1 to 25, 25 being 79
80
76
77
0
0
18
13
the bestDo these data support the 81 78 0 6
company hypothesis that exercisers 82
83
79
80
0
0
19
11
outperform nonexercisers on average? 84
USING Tools Data Analysis
EXCEL
t Test: Two-Sample Assuming Equal Variances
H 0 : 1 2 t-Test: Two-Sample Assuming Equal Variances

H1 : 1 2 Mean
Variable 1 Variable 2
16.86207 14.13725
Variance 16.83744 28.16078

( x1 x1 ) (1 2 ) Observations 29 51
t* Pooled Variance
Hypothesized Mean Difference
24.09599
0
1 1

df 78
sp t Stat 2.386731
n1 n2 P(T<=t) one-tail 0.009711
t Critical one-tail 1.664625

2.386731 P(T<=t) two-tail


t Critical two-tail
0.019422
1.990848

Decision Rule: reject H0 if p-value


p-value = 0.009711 = 0.09% < =5%
H0 is rejected and we conclude there is enough evidence to infer that exercisers
outperform nonexercisers.

You might also like