You are on page 1of 27

Two Sample Tests on

Means & Proportions


Difference between Two Population Means: 𝜎1 , 𝜎2 Known
Difference between Two Population Means:𝜎1 , 𝜎2 Unknown
Difference between Two Population Means: Matched Samples
Difference between Two Population Proportions
Confidence Interval Estimate of 𝜇1 − 𝜇2
𝝈𝟏 & 𝝈𝟐 KNOWN 𝝈𝟏 & 𝝈𝟐 UNKOWN

𝑠1 2 𝑠2 2
𝑥ҧ1 − 𝑥ҧ2 ± 𝑡𝛼Τ2 +
𝑛1 𝑛2
𝜎1 2 𝜎2 2
𝑥ҧ1 − 𝑥ҧ2 ± 𝑧𝛼Τ2 + Where the degrees of freedom for 𝑡𝛼Τ2 :
𝑛1 𝑛2 𝑠1 2 𝑠2 2
2
+
𝑛1 𝑛2
𝑑𝑓 = 2 2
1 𝑠1 2 1 𝑠2 2
+𝑛 −1 𝑛
𝑛1 − 1 𝑛1 2 2

Where:
𝜎1 2 𝜎2 2 𝑠1 2 𝑠2 2
𝑥ҧ1 − 𝑥ҧ2 = point estimate of 𝜇1 − 𝜇2 ; + = standard error for 𝑧; + = standard error for 𝑡
𝑛1 𝑛2 𝑛1 𝑛2
Forms of 𝐻0 & 𝐻𝑎 for 𝜇1 − 𝜇2
Two-Tail Test Upper-Tail Test Lower-Tail Test
𝐻0 : 𝜇1 − 𝜇2 = 𝐷0 𝐻0 : 𝜇1 − 𝜇2 ≤ 𝐷0 𝐻0 : 𝜇1 − 𝜇2 ≥ 𝐷0
𝐻𝑎 : 𝜇1 − 𝜇2 ≠ 𝐷0 𝐻𝑎 : 𝜇1 − 𝜇2 > 𝐷0 𝐻𝑎 : 𝜇1 − 𝜇2 < 𝐷0
Or Or Or
𝐻0 : 𝜇1 = 𝜇2 𝐻0 : 𝜇1 ≤ 𝜇2 𝐻0 : 𝜇1 ≥ 𝜇2
𝐻𝑎 : 𝜇1 ≠ 𝜇2 𝐻𝑎 : 𝜇1 > 𝜇2 𝐻𝑎 : 𝜇1 < 𝜇2

Where: 𝐷0 = ℎ𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑧𝑒𝑑 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒 (𝑢𝑠𝑢𝑎𝑙𝑙𝑦 𝑧𝑒𝑟𝑜 𝑖𝑓 𝑛𝑜𝑡 𝑔𝑖𝑣𝑒𝑛)


Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Known
Test Statistic Formula
𝑥ҧ1 − 𝑥ҧ2 − 𝐷0
𝑧=
𝜎1 2 𝜎2 2
+
𝑛1 𝑛2
𝜎1 2 𝜎2 2
Where: + = standard error
𝑛1 𝑛2

PHStat → Enable Macros → Add-Ins → PHStat → Two Sample


Tests (Summarized Data) → Z Test for Differences in Two Means
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Known
Example 1. Buymore sells appliances at two stores located in Burbank
and Pasadena. The Regional Manager noticed that products that sell
well in one store do not always sell well in the other. He wants to
investigate the difference between the mean ages of the customers
who shop at the two stores. Based on previous study, population
standard deviation are assumed at 𝜎B = 9 and 𝜎P = 10 years. The
samples statistics are shown below. Test at 1% level of significance if
mean age of Burbank customers is greater than the mean age of
Pasadena customers.
BURBANK PASADENA
Sample Size 36 49
Sample Mean 40 years 35 years
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Known
Example 1. 𝑛𝐵 = 36; 𝑥ҧ𝐵 = 40; 𝜎B = 9; 𝑛𝑃 = 49; 𝑥ҧ𝑃 = 35; 𝜎P = 10
a. Formulate 𝐻0 & 𝐻𝑎
b. Construct a 90% confidence interval
c. Construct a 95% confidence interval
d. Determine the test statistic value
e. Compute the p-value
f. Find the critical value
g. What is your decision & conclusion?
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Known
Example 1. 𝑛𝐵 = 36; 𝑥ҧ𝐵 = 40; 𝜎B = 9; 𝑛𝑃 = 49; 𝑥ҧ𝑃 = 35; 𝜎P = 10
Answer:
a. 𝐻0 : 𝜇𝐵 − 𝜇𝑃 ≤ 0; 𝐻𝑎 : 𝜇𝐵 − 𝜇𝑃 > 0
b. 5 ± 1.645 92 Τ36 + 102 Τ49 = 1.59 𝑦𝑒𝑎𝑟𝑠 to 8.41 𝑦𝑒𝑎𝑟𝑠
c. 5 ± 1.96 92 Τ36 + 102 Τ49 = 0.94 𝑦𝑒𝑎𝑟𝑠 to 9.06 𝑦𝑒𝑎𝑟𝑠
d. 𝑧 = 2.41
e. p-value = 𝑧 > 2.41 = 1 − .9920 = .008
f. C.V. = 2.33
g. Decision & Conclusion: Reject Ho since z > 2.33 (or p-value < .01). Thus,
the mean age of Burbank customers is greater than the mean age of
Pasadena customers
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Known
Example 1. Z Test for Differences in Two Means

𝑛𝐵 = 36; 𝑥ҧ𝐵 = 40; 𝜎B = 9; Hypothesized Difference


Data
0

𝑛𝑃 = 49; 𝑥ҧ𝑃 = 35; 𝜎P = 10 Level of Significance


Population 1 Sample
0.01

Sample Size 36
Sample Mean 40
Population Standard Deviation 9
PHStat Output: Population 2 Sample

PHStat → Enable Macros


Sample Size 49
Sample Mean 35
Population Standard Deviation 10
→ Add-Ins →PHStat → Intermediate Calculations
Two Sample Tests (Summarized Data) Difference in Sample Means
Standard Error of the Difference in Means
5
2.0714

→ Z Test for Differences in Two Means Z Test Statistic 2.4138

Upper-Tail Test
Upper Critical Value 2.3263
p-Value 0.0079
Reject the null hypothesis
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Unknown
Test Statistic Formula
𝑥ҧ1 − 𝑥ҧ2 − 𝐷0
𝑡=
𝑠1 2 𝑠2 2
+
𝑛1 𝑛2
𝑠1 2 𝑠2 2
Where: + = standard error
𝑛1 𝑛2

PHStat → Enable Macros → Add-Ins → PHStat → Two Sample


Tests (Summarized Data) → Separate-Variance t Test
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Unknown
Example 2. Wayne Enterprises are well known in producing armored
cars called the Tumbler. They developed a new car called the
Batmobile. They want to test if the Batmobile is faster than the
Tumbler using 5% level of significance. A test was ran and produced
the following data:

BATMOBILE TUMBLER
Sample Size 24 cars 28 cars
Sample Mean 29.8 mph 27.3 mph
Sample Stand. Dev. 2.56 mph 1.81 mph
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Unknown
Example 2. 𝑛𝐵 = 24; 𝑥ҧ𝐵 = 29.8; 𝑠B = 2.56; 𝑛 𝑇 = 28; 𝑥ҧ 𝑇 = 27.3
𝑠T = 1.81; Upper-tail test; 𝛼 = .05
a. Formulate 𝐻0 & 𝐻𝑎
b. Calculate the degrees of freedom
c. Construct a 95% confidence interval
d. Determine the test statistic value
e. Compute the p-value
f. Find the critical value
g. What is your decision & conclusion?
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Unknown
Example 2. 𝑛𝐵 = 24; 𝑥ҧ𝐵 = 29.8; 𝑠B = 2.56; 𝑛 𝑇 = 28; 𝑥ҧ 𝑇 = 27.3
𝑠T = 1.81; Upper-tail test; 𝛼 = .05
Answer:
a. 𝐻0 : 𝜇𝐵 − 𝜇 𝑇 ≤ 0; 𝐻𝑎 : 𝜇𝐵 − 𝜇 𝑇 > 0
b. 𝑑𝑓 = 41 (rounded off to the nearest whole number)
2
2.562 1.812
+
24 28
𝑑𝑓 = 2 2 = 40.59
1 2.562 1 1.812
+
23 24 27 28

c. 2.5 ± 2.020 2.562 Τ24 + 1.812 Τ28 = 1.24𝑚𝑝ℎ to 3.76𝑚𝑝ℎ


Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Unknown
Example 2. 𝑛𝐵 = 24; 𝑥ҧ𝐵 = 29.8; 𝜎B = 2.56; 𝑛 𝑇 = 28; 𝑥ҧ 𝑇 = 27.3
𝜎T = 1.81; Upper-tail test; 𝛼 = .05
Answer:
d. 𝑡 = 4.003
e. At df = 41, P-value < .005 since it exceeds the table
f. C.V. = 1.683 (at df=41, 𝛼 = .05)
g. Decision & Conclusion: Reject Ho since 4.003 > 1.683 (or p-value <
.05). Thus, Batmobile is faster than Tumbler.
Hypothesis Test for 𝜇1 − 𝜇2 : 𝜎1 , 𝜎2 Unknown
Separate-Variances t Test for the Difference Between Two Means

Example 2. PHStat Output: (assumes unequal population variances)


Data

PHStat → Enable Macros →


Hypothesized Difference 0
Level of Significance 0.05
Population 1 Sample

Add-Ins → PHStat →Two Sample Sample Size


Sample Mean
24
29.8

Tests (Summarized Data)


Sample Standard Deviation 2.5600
Population 2 Sample
Sample Size 28

→ Separate-Variance t Test Sample Mean


Sample Standard Deviation
27.3
1.8100

Intermediate Calculations
Numerator of Degrees of Freedom 0.1522
Denominator of Degrees of Freedom 0.0037
Total Degrees of Freedom 40.5854
Degrees of Freedom 40
Standard Error 0.6246
Difference in Sample Means 2.5000
Separate-Variance t Test Statistic 4.0028

Upper-Tail Test
Upper Critical Value 1.6839
p-Value 0.0001
Reject the null hypothesis
Hypothesis Test for 𝜇1 − 𝜇2 : Matched
Samples
In the matched (paired) sample design, each element provides a pair
of data values, one from each population.
The difference between the paired data values is used in the
statistical analysis.
The matched sample design is generally preferred to the independent
sample design because it often improves the precision of estimate. It
also leads to a smaller sampling error, because the variation between
sampled items is eliminated as a source of error.
Hypothesis Test for 𝜇1 − 𝜇2 : Matched
Samples
STEPS:
Determine the difference of each pair
Calculate the mean and standard deviation of the differences
Use One-sample t-test to calculate the test statistic value:
ഥ − 𝝁𝒅
𝒅
𝒕= ; 𝒅𝒇 = 𝒏 − 𝟏
𝒔𝒅 Τ 𝒏𝒅
Where: 𝑑ҧ = mean of the differences; 𝑠𝑑 = stand. Dev. of the differences; 𝑛𝑑 = no. of pairs

PHStat → Two Sample Tests → Summarized Data → Paired t Test.


Hypothesis Test for 𝜇1 − 𝜇2 :Matched Samples
District Office UPS FedEx
Example 3. Beckett Co. produces a price
guide magazines and distributes them Los Angeles 32 25
across the US. The company must decide Miami 30 24
between two delivery services, UPS and Oklahoma 19 15
FedEx, to transport the magazines. In Boston 16 15
testing the delivery times of the two
San Antonio 15 13
services, the firm sent two reports for a
random sample of its district offices. Test Chicago 18 15
whether a significant difference exists in Dallas 14 15
mean delivery time (in hours) for the two New York 10 8
services. Use a .05 level of significance. Denver 7 9
Atlanta 16 11
Hypothesis Test for 𝜇1 − 𝜇2 : Matched
Samples
Dis Ofc UPS FedEx d
Example 3. Find the following
L.A. 32 25 7
a. Formulate 𝐻0 & 𝐻𝑎 Miami 30 24 6
b. Determine the test statistic value Okla 19 15 4
c. Find the p-value Boston 16 15 1
San Ant 15 13 2
d. Find the critical value
Chicago 18 15 3
e. What is your decision & conclusion? Dallas 14 15 -1
N. York 10 8 2
Denver 7 9 -2
Atlanta 16 11 5
Hypothesis Test for 𝜇1 − 𝜇2 : Matched
Samples
PHStat → One Sample → Summarized
Example 3. Answers Data → Paired t Test.
Paired t Test

a. 𝐻0 : 𝜇𝑈 − 𝜇𝐹 = 0; 𝐻𝑎 : 𝜇𝑈 − 𝜇𝐹 ≠ 0 Data

b. 𝑑ҧ = 2.7; 𝑠𝑑 = 2.91; 𝑛 = 10 Hypothesized Mean Difference


Level of significance
0
0.05
𝑥ҧ − 𝜇𝑑 2.7 − 0
𝑡= = = 2.93 Intermediate Calculations

𝑠Τ 𝑛 2.91Τ 10 Sample Size


DBar
10
2.7000

c. P-value = 2(.005) to 2(.01) = 0.01 to 0.02 Degrees of Freedom

SD
9

2.9078

d. C.V. = 2.262 (at 𝑑𝑓 = 9; 𝛼Τ2 = 0.025) Standard Error


t Test Statistic
0.9195
2.9362

e. Reject Ho. Thus, there’s a significant Two-Tail Test

difference between the mean delivery Lower Critical Value


Upper Critical Value
-2.2622
2.2622
time of the two services. p-Value 0.0166
Reject the null hypothesis
Confidence Interval Estimate of 𝑝1 − 𝑝2

ഥ𝟏 (𝟏 − 𝒑
𝒑 ഥ𝟏 ) 𝒑ഥ𝟐 (𝟏 − 𝒑
ഥ𝟐 )
ഥ𝟏 − 𝒑
𝒑 ഥ 𝟐 ± 𝒛𝜶Τ𝟐 +
𝒏𝟏 𝒏𝟐

Where:
𝑥1 𝑥2
𝑝1ҧ = ; 𝑝2ҧ =
𝑛1 𝑛2
Forms of 𝐻0 & 𝐻𝑎 for 𝑝1 − 𝑝2
Two-Tail Test Upper-Tail Test Lower-Tail Test
𝐻0 : 𝑝1 − 𝑝2 = 0 𝐻0 : 𝑝1 − 𝑝2 ≤ 0 𝐻0 : 𝑝1 − 𝑝2 ≥ 0
𝐻𝑎 : 𝑝1 − 𝑝2 ≠ 0 𝐻𝑎 : 𝑝1 − 𝑝2 > 0 𝐻𝑎 : 𝑝1 − 𝑝2 < 0
Or Or Or
𝐻0 : 𝑝1 = 𝑝2 𝐻0 : 𝑝1 ≤ 𝑝2 𝐻0 : 𝑝1 ≥ 𝑝2
𝐻𝑎 : 𝑝1 ≠ 𝑝2 𝐻𝑎 : 𝑝1 > 𝑝2 𝐻𝑎 : 𝑝1 < 𝑝2
Hypothesis Test for 𝑝1 − 𝑝2
Test Statistic Formula
ഥ𝟏 − 𝒑
𝒑 ഥ𝟐
𝒛=
𝟏 𝟏 pooled estimate of
ഥ(𝟏 − 𝒑
𝒑 ഥ) +
𝒏𝟏 𝒏𝟐 standard error

Where:
𝑿𝟏 + 𝑿𝟐
ഥ=
𝒑
𝒏𝟏 + 𝒏𝟐
𝑋1 = no. of sucesses in sample 1
𝑋2 = no. of sucesses in sample 2
Hypothesis Test for 𝑝1 − 𝑝2
Example 4. ADS Inc. is conducting a research to evaluate the
effectiveness of a client’s new advertising campaign. Before the new
campaign, a survey of 150 respondents from the test market area
showed 60 respondents were aware of the client’s product. The new
campaign has been initiated with TV and newspaper ads running for
three weeks. After the new campaign, a survey was conducted
immediately and showed that 120 of 250 respondents were aware of
the client’s product. Does the data support the position that the new
advertising campaign has provided an increased awareness of the
client’s product? Assume a 95% confidence level.
Hypothesis Test for 𝑝1 − 𝑝2
60 120
Example 4. 𝑝𝐵ҧ = = .40; 𝑝𝐴ҧ = = .48; 𝛼 = 0.05
150 250
a. Formulate 𝐻0 & 𝐻𝑎
b. Construct a 95% interval estimate
c. Determine the test statistic value
d. Find the p-value & critical value
e. What is your decision & conclusion?
Hypothesis Test for 𝑝1 − 𝑝2
60 120
Example 4. 𝑝ҧ𝐵 = = .40; 𝑝𝐴ҧ = = .48; 𝛼 = 0.05
150 250
a. 𝐻0 : 𝑝𝐴 − 𝑝𝐵 ≤ 0; 𝐻𝑎 : 𝑝𝐴 − 𝑝𝐵 > 0
.48 .52 .40 .60
b. . 48 − .40 ± 1.96 250
+
150
= −.02 𝑡𝑜 0.18
60+120 .48−.40
c. 𝑝 = 150+250
= .45; 𝑧 =
1 1
= 1.56
.45(1−.45) 250+150

d. p-value = 𝑃 𝑧 > 1.56 = .0594; C.V. = 1.645


e. Decision & Conclusion: Do not Reject Ho. Thus, the advertising
campaign did not increase awareness of the client’s product.
Hypothesis Test for 𝑝1 − 𝑝2
Z Test for Differences in Two Proportions
Example 4. PHStat Output: Hypothesized Difference
Data
0

PHStat → Enable Macros Level of Significance


Group 1
0.05

→ Add-Ins →PHStat → Number of Items of Interest


Sample Size
120
250

Two Sample Tests (Summarized Data) Group 2


Number of Items of Interest 60

→ Z Test for Differences in Two Proportions Sample Size 150

Intermediate Calculations
Group 1 Proportion 0.48
Group 2 Proportion 0.4
Difference in Two Proportions 0.08
Average Proportion 0.4500
Z Test Statistic 1.5570

Two-Tail Test
Lower Critical Value -1.9600
Upper Critical Value 1.9600
p-Value 0.1195
Do not reject the null hypothesis
END OF LECTURE

You might also like