Hypothesis Testing for Two Samples
Hypothesis Testing for Two Samples
Chapter 10
1
Ideas in Chapter 10
• How to use hypothesis testing for comparing the difference
between
• The means of two related populations
• The means of two independent populations
• The proportions of two independent populations
2
10.2 Comparing Means of Two Related (Dependent) Populations
• Confidence
Interval for dependent pairs is derived in same
manner as for one sample mean – except that you’re using the
difference in your pairs (value1 – value2),
ALWAYS in the same order,
to find the DIFFERENCES to calculate the sample statistic, d
R.K. 0 0 0 n 1
M.O. 4 0 -4
-21 sum
5.67
SD 5.67 α = 0.01 = 0.005
99%CI Xd t / 2 4.2 4.604( )
n 5 df = n – 1 = 5 – 1 = 4
(-15.87, 7.47)
t = 4.604
We are 99% confident that the difference in customer complaints, AFTER and BEFORE
training is at least -15.87 and at most 7.47. Because the CI covers 0, we cannot be 99%
confident that µD is not equal to 0 (i.e., no difference).
couple husband wife husband-wife
11 25
25 22
22 3
Example: We are interested in whether there is a 22 25 32 -7
25 32
difference in the mean age at which men marry 3
3
51
51
50
50
1
4 25 25 0
and the age at which women marry. The 54 25
38 25
33 5
following data was collected from a random 65 38
30 33
27 3
sample of 24 couples. Compute and interpret a 76 30
60 27
45
15
87 60
54 45
47 7
90% confidence interval on the mean difference 98 31
54 30
47 1
between husbands’ and wives’ age at marriage. 109 54
31 44
30 10
Assume that ages at marriage follow a normal 11
10 23
54 23
44 0
12
11 34
23 39
23 -5
distribution. 13 25 24 1
12 34 39
90% confidence interval results: 14 23 22 1
13
15 25
19 24
16 3
μ1 - μ2 : mean of the paired 14
16 23
71 22
73
-2
15
17 19
26 16
27
-1
difference between husband and wife 16
18 71
31 73
36
-5
𝑋´ 𝑑 =1.875 𝑆 𝐷=4.812 α = 0.10 = 0.05 19
17 26 24
27 2
𝑆𝐷 20
18 62
31 60
36 2
´
90 % 𝐶𝐼 = 𝑋 𝑑 ± 𝑡 df = n – 1 = 24 – 1 = 23 21
19 29
26 26
24 3
√ 𝑛4.812 22
20 31
62 23
60 8
¿ 1.875 ± 1.7139 ( ) t = 1.7139 23
21
29
29
28
26
1
√ 24 24
22
35
31
36
23
-1
23 29 28
3.55852)
24 35 36
Interpretation: We are 90% confident that the mean age at which men marry is at
least 0.19 and at most 3.5 years greater than the mean age at which women
marry. That is, we are 90% confident that the average age at which men marry is
higher than the average age at which women marry.
Question:
Nine experts rated two brand of Colombian coffee Brand
Expert A B
in a taste-testing experiment. A rating on a 7- C.C. 24 26
point scale (1 = extremely unpleasing 7 = S.E. 27 27
extremely pleasing) is given for each of four E.G. 19 22
characteristics: taste, aroma, richness and acidity. B.L. 24 27
The table at the right contains the rating C.M. 22 25
C.N. 26 27
accumulated over all four characteristics: G.N. 27 26
• Is the assumption that the populations are R.M. 25 27
P.V. 22 23
dependent or independent?
A. Dependent / related
B. Independent / not related
• What is your next step?
A. Calculate means and standard deviations for Brand A and Brand B
B. Calculate differences for each pair always in the direction that
will provide a positive difference. Then determine d (that is, ) and sd for
the sample of differences
C. Calculate differences for each pair always in the same direction. Then
determine d (that is, ) and sd for the sample of differences
11
Review:
• Statistical
significance versus Practical significance
• Is “significance” used in the usual sense or the statistical sense
• Very large sample sizes can lead to statistical significance for
very small differences determine sample size for evaluation
• If possible, look at confidence intervals to interpret
• Confidence Interval for dependent pairs is derived in same manner
as for one sample mean – except that you’re using the difference in
your pairs (value1 – value2),
ALWAYS in the same order,
to find the DIFFERENCES to calculate the sample statistic, d
• d is the point estimate (statistic) for µd (parameter)
• Confidence Interval for µd is given by CIµd d ± t()
• n is the number of pairs and degrees of freedom = n - 1
Hypothesis Tests for Population Mean Difference
(DEPENDENT)
Steps for a Hypothesis Test:
1. Check assumptions
• Sample of difference scores is a random sample from a population of such
difference scores
• Difference scores have a population distribution that is approximately
normal. This is important for small samples (less than about 30). If the
sample size is small, make a graphical display and check for extreme
outliers or skew
2. Set up hypotheses:
• Ho: μd = μ1– μ2 ≥, ≤, or = 0
• Ha: μd = μ1– μ2 <, > or ≠ 0
xd 0
3. Calculate test statistic. t
(Use software, sd / n
and/or it will be given in output.)
Hypothesis Tests for Population Mean Difference
(DEPENDENT)
Steps for a Hypothesis Test:
4. Calculate p-value
(Use software. It will be given in output)
• If using the > alternative, p-value = P(T > t)
• If using the < alternative, p-value = P(T < t)
• If using the ≠ alternative, p-value = 2 * P(T < -|t|) if using E.3
5. Draw conclusion and interpret the results
• If p-value ≤ α (or if p-value is less than .01 when no α is
given), reject H0 (With p-value = _______, we have
sufficient evidence that (state HA in problem context)
• If p-value > α (or if p-value is greater than .10 when no α is
given), do not reject H0 (With p-value = _______, we do
not have sufficient evidence that (state HA in problem context)
With P-value = 0.0688 and α = 0.10, there is sufficient evidence that the mean
age at which men marry differs from the mean age at which women marry.
Example: (Salt Free Diet) Salt-free diets are often prescribed for people
with high blood pressure. The following data are from an experiment
designed to estimate the reduction in diastolic blood pressure (in units
called millimeters of mercury (mm Hg)) as a result of following such a
diet for 2 weeks. Assume diastolic readings follow a normal distribution.
Before 93 106 87 92 102 95 88 110
After 92 102 89 92 101 96 88 105
Difference: (After – Before) -1 -4 2 0 -1 1 0 -5
a) Find and interpret a 99% confidence interval for the true mean
reduction in blood pressure.
99% confidence interval results:
μAfter - μBefore : mean of the paired difference between After and Before
Difference Sample Diff. Std. Err. DF L. Limit U. Limit
After – Before -1 0.8451542 7 -3.9576032 1.9576032
20
10.4 F-Test for the Ratio of Two Variances (sort of…)
21
Two populations Two variances
•• Methods
to combine the variances:
• If those variances are UNEQUAL UNPOOLED
• If variances are EQUAL POOLED
•
where
If LL and UL are both less than 0, this suggests that group B has the greater mean.
• Interpretation: We can be 95 %* confident that the population mean for group B
is at least |UL| and at most |LL| units greater than the population mean for
group A.
If LL is less than 0, and UL is greater than 0, neither group clearly has the greater
mean.
• Interpretation: With 95 %* confidence, it is unclear whether group A or group B
has the greater population mean. If group A has the greater population mean, it
is by at most UL units and if group B has the greater population mean, it is by at
most |LL| units. *Use correct Level of Confidence
Example: (variances assumed equal)
• and some friends have decided to test
You Local
16.8
Chain
22.0
the validity of an advertisement by a local 11.7
15.6
15.2
18.7
pizza restaurant, which says it delivers to 16.7
17.5
15.6
20.8
the dormitories faster than a local brand of 18.1 19.5
14.1 17.0
a national chain. Both the local pizza 21.8 19.5
13.9 16.5
restaurant and national chain are located 20.8 24.0
across the street from your college campus. n1=
10
n2=
10
You define the variable of interest as the
delivery time, in minutes, from the time the
pizza is ordered to when it is delivered. You
collect the data by ordering 10 pizzas from
Are the populations of delivery
the local pizza restaurant and 10 pizzas times for local and national
from the national chain at different times. pizzerias independent or
You organize and store the data in the excel
spreadsheet shown. At the α=0.05 level, is dependent?
there evidence that the mean delivery time A. Independent
for the local pizza restaurant is less than the B. Dependent
mean delivery time for the national pizza
chain?
H0: (local delivery time longer than chain)
HA: (local delivery time less than chain)
Example: (variances assumed equal)
• and some friends have decided to test
You Local
16.8
Chain
22.0
the validity of an advertisement by a local 11.7 15.2
pizza restaurant, which says it delivers to 15.6 18.7
16.7 15.6
the dormitories faster than a local brand of 17.5 20.8
a national chain. Both the local pizza 18.1 19.5
restaurant and national chain are located 14.1
21.8
17.0
19.5
across the street from your college campus. 13.9 16.5
You define the variable of interest as the n1=
20.8
n2=
24.0
32
Review
•• Methods
to combine the variances:
• If those variances are UNEQUAL UNPOOLED
(df calculated via Welch-Satterthwaite)
36
Hypothesis Example: 2 Population Proportions
• there a significant difference between the proportion of men and
Is
the proportion of women who will vote Yes on Proposition A? In a
random sample, 36 of 72 men and 35 of 50 women indicated they
would vote “Yes.” Test at the .05 level of significance. Let p1 be the
proportion of men and p2 be the proportion of women.
• Hypotheses: H0: p1 – p2 = 0 and
HA: p1 – p2 ≠ 0
•
• Critical values = ±1.96 for α=0.05 Reject H0 Reject H0
37
CI for Two Population Proportions
• Confidence
Interval for p1 – p2 is:
•
• EXAMPLE: 95% CI for Men/Women voters on Proposition A
(previous)
• = (-0.37 , -0.03)
• Interpretation: We are 95% confident that the true difference in
proportions between men and women is at least -0.37 and at most
-0.03. That is, because the entire CI is below zero, we can be 95%
confident that the two proportions are different.
38









