University of Khartoum
Faculty of Mathematical Sciences and Informatics
Information Technology Department
Applied Statistics
Lecture 5
Confidence interval for difference between two means:( 2
1 and 2
2 known)
2 2 2 2
1 2 1 2
( X1 X2) Z 1 2 ( X1 X2) Z
2
n1 n2 2
n1 n2
Example:
A survey found that the average hotel room rate in city A is 88.42 and the
average room rate in city B is 80.61. Assume that the data were obtained from
two samples of 50 hotels each and that the standard deviations from the
populations were 5.62 and 4.83, respectively. Find the 95% confidence
interval for the difference between the means ( 1 2 ).
Solution
X1 88.42 , X 2 80.61 , 1 5.62 , 2 4.83 , n1 50 , n2 50
Z Z 0.025 1.96
2
2 2 2 2
1 2 1 2
( X1 X2) Z 1 2 (X1 X2) Z
2
n1 n2 2
n1 n2
5.622 4.832 5.62 2 4.832
(88.42 80.61) (1.96) 1 2 (88.42 80.61) (1.96)
50 50 50 50
5.76 1 2 9.86
Confidence interval for difference between two means:( 2
1 and
2
2 unknown
and unequal)
S12 S 22 S12 S 22
( X1 X 2 ) t (d . f .) 1 2 ( X1 X 2 ) t (d . f .)
2
n1 n2 2
n1 n2
d . f . smaller value of n1 1 or n2 1
19
Example:
The average size of a farm in A is 191 acres. The average size of a farm in B is
199 acres. Assume the data were obtained from two samples with standard
deviations of 38 acres and 12 acres, respectively, and sample sizes of 8 and 10,
respectively. Find the 95% confidence interval for 1 2 if
2
1 2 .
2
Solution
X1 191 , X 2 199 , S1 38 , S 2 12 , n1 8 , n2 10 , t 0.025 (7) 2.365
S12 S 22 S12 S 22
(X1 X 2 ) t (d . f .) 1 2 (X1 X 2 ) t (d . f .)
2
n1 n2 2
n1 n2
382 122 382 122
(191 199) (2.365) 1 2 (191 199) (2.365)
8 10 8 10
41.02 1 2 25.02
Confidence interval for difference between two means:( 2
1 and 2
2 unknown
and equal)
1 1 1 1
(X1 X 2 ) t (n1 n2 2) S p 1 2 (X1 X 2 ) t (n1 n2 2) S p
2
n1 n2 2
n1 n2
2 2
(n1 1) S (n2 1) S
S p2 1 2
n1 n2 2
Example:
Suppose the following data
Sample 1 Sample 2
X1 26800 X1 25400
S1 600 S1 450
n1 10 n1 8
Assume that the population variances are equal ( 12 2
2 ).
Find the 90% confidence interval for the difference between the means.
Solution
(n1 1) S12 (n2 1) S 22 (9)(600) 2 (7)(450) 2
S p2 291093.75
n1 n 2 2 10 8 2
Sp 291093.75 539.5
1 0.9 0.05
2
t (n1 n2 2) t 0.05 (16) 1.746
2
20
1 1 1 1
( X1 X 2 ) t (n1 n2 2) S p 1 2 (X1 X 2 ) t ( n1 n2 2) S p
2
n1 n2 2
n1 n2
1 1 1 1
(26800 25400) (1.746)(539.5) 1 2 (26800 25400) (1.746)(539.5)
10 8 10 8
953.5 1 2 1846.5
Confidence interval for difference between two means:(dependent samples)
SD SD
D t (n 1) D D t (n 1)
2 n 2 n
D X1 X2
D
D D 1 2
n
1
SD (D D )2
n 1
Example:
is supplemented by a certain mineral.
Subject 1 2 3 4 5 6
Before ( X 1 ) 210 235 208 190 172 244
After ( X 2 ) 190 170 210 188 173 228
Find the 90% confidence interval for the mean difference.
Solution
Before ( X 1 ) After ( X 2 ) D X 1 X 2 D 100
210 190 20 D 16.7
n 6
235 170 65
1
208 210 -2 SD ( D D ) 2 25.4
190 188 2 n 1
172 173 -1 t (n 1) t 0.05 (5) 2.015
2
244 228 16
SD SD
D t (n 1) D D t (n 1)
2 n 2 n
25.4 25.4
16.7 (2.015) D 16.7 (2.015)
6 6
4.19 D 37.59
21
Confidence interval for difference between two proportions:
P1 (1 P1 ) P2 (1 P2 ) P1 (1 P1 ) P2 (1 P2 )
( P1 P2 ) Z P1 P2 ( P1 P2 ) Z
2
n1 n2 2
n1 n2
Example:
The researchers found that 12 out of 34 small nursing homes had a resident
vaccination rate of less than 80%, while 17 out of 24 large nursing homes had a
vaccination rate of less than 80%.
Find the 95% confidence interval for the difference of proportions.
Solution
12 17
P1 0.35 , P2 0.71 , Z 1.96
34 24 2
P1 (1 P1 ) P2 (1 P2 ) P1 (1 P1 ) P2 (1 P2 )
( P1 P2 ) Z P1 P2 ( P1 P2 ) Z
2
n1 n2 2
n1 n2
(0.35)(0.65) (0.71)(0.29) (0.35)(0.65) (0.71)(0.29)
(0.35 0.71) (1.96) P1 P2 (0.35 0.71) (1.96)
34 24 34 24
0.602 P1 P2 0.118
22
Confidence interval for the mean ( 2
known):
X Z X Z
2 n 2 n
Confidence interval for the mean ( 2 unknown):
S S
X t (n 1) X t (n 1)
2 n 2 n
Confidence interval for the proportion:
P(1 P) P(1 P)
P Z P P Z
2
n 2
n
Confidence interval for variance:
(n 1) S 2 2 (n 1) S 2
2 2
(n 1) (n 1)
1
2 2
2 2
Confidence interval for difference between two means:( 1 and 2 known)
2 2 2 2
1 2 1 2
( X1 X2) Z 1 2 ( X1 X2) Z
2
n1 n2 2
n1 n2
Confidence interval for difference between two means:( 2
1 and 2
2 unknown
and unequal)
S12 S 22 S12 S 22
( X1 X 2 ) t (d . f .) 1 2 ( X1 X 2 ) t (d . f .)
2
n1 n2 2
n1 n2
d . f . smaller value of n1 1 or n2 1
2 2
Confidence interval for difference between two means:( 1 and 2 unknown
and equal)
1 1 1 1
( X1 X 2 ) t (n1 n2 2) S p 1 2 (X1 X 2 ) t (n1 n2 2) S p
2
n1 n2 2
n1 n2
2 2
(n1 1) S (n2 1) S
S p2 1 2
n1 n2 2
Confidence interval for difference between two means:(dependent samples)
S S
D t (n 1) D D D t (n 1) D
2 n 2 n
Confidence interval for difference between two proportions:
P1 (1 P1 ) P2 (1 P2 ) P1 (1 P1 ) P2 (1 P2 )
( P1 P2 ) Z P1 P2 ( P1 P2 ) Z
2
n1 n2 2
n1 n2
23
Exercises:
1. Find the 95% confidence interval for the variance and standard
deviation of the following data.
12.03 12.10 12.02 11.98 12.00 12.05 11.97 11.99
2. Find the 95% confidence interval for the difference between two means,
using the following data.
Sample A: X 837 30 n 35
Sample B: X 753 40 n 40
3. Suppose the following data.
Sample 1 Sample2
25 57 34 5 28 37
42 21 44 16 16 48
Find the 90% confidence interval for the difference between two means
2 2
i. If 1 2 .
2 2
ii. If 1 2 .
4. College students played one round of golf. After a week, they played a
second round of golf. The scores are shown below.
Golfer 1 2 3 4 5 6 7
First day 80 72 78 68 75 69 72
Last day 78 75 72 70 72 68 73
Find the 99% confidence interval for the difference between two means.
5. Find the 95% confidence interval for the true difference in proportions
for the data of a study in which 40% of the 200 males surveyed opposed
the death penalty and 56% of the 100 females surveyed opposed the
death penalty.
6. In a sample of 200 men, 130 said they used seat belts. In a sample of 300,
63 said they used seat belt.
Find the 99% confidence interval for the true difference in proportions.
24