Statistic 6
This week will continue to discuss hypothesis testing and confidence interval, but
now we will discuss 2 samples.
Just like with 1 – sample hypothesis testing there are 4 steps we will follow. To
review those 4 steps please review the Week 6 Hypothesis Testing PDF.
But the conclusion will still be the same.
If the p-value is < alpha, you Reject Ho and state this test is significant.
If the p-value is > alpha, you Do Not Reject Ho and state this test is not significant.
In this document we will discuss 2 – sample proportion hypothesis testing and
confidence intervals.
There are still 3 different hypothesis scenarios with a 2 – sample proportion
hypothesis test.
Lower Tail Test (1 tail):
Ho: 𝑝1 − 𝑝2 = 0
Ha: 𝑝1 − 𝑝2 < 0
Upper Tailed Test (1 tail):
Ho: 𝑝1 − 𝑝2 = 0
Ha: 𝑝1 − 𝑝2 > 0
Two Tailed Test:
Ho: 𝑝1 − 𝑝2 = 0
Ha: 𝑝1 − 𝑝2 ≠ 0
The hypothesized value is 0 and the same key words apply from a 1 – sample
hypothesis test to determine which scenario to use.
The Z – Test Statistic = 𝑝1− 𝑝2
√𝑝∗𝑞( 1
𝑛1 +
1
𝑛2 )
Where 𝑝 = 𝑥1+𝑥2
𝑛1+𝑛2
𝑞 = 1 − 𝑝
We will then use =NORM.S.DIST function in Excel to find the p-value. This Excel
function should look familiar from Week 4.
Example:
In a developing section of a district 50 people were surveyed and 38 were in favor
of the new proposal. For the rest of the district 100 people were surveyed and
only 65 people were in favor of the new proposal. Is there evidence that the
number of people favoring the new proposal is greater in the developing section
than the rest of the district? Use alpha = .05
First step is to state the hypothesis scenario. Because the key word says greater
this means it is an upper tailed test.
Ho: 𝑝1 − 𝑝2 = 0
Ha: 𝑝1 − 𝑝2 > 0
The first proportion is favoring the new proposal in the developing district and the
second proportion is favoring the new proposal in the rest of the district.
𝑝1 = 38
50 = .76
𝑞1 = 1 − .76 = .24
𝑝2 = 65
100 = .65
𝑞2 = 1 − .65 = .35
𝑝 = 38 + 65
50 + 100 = .68667
𝑞 = 1 − .68667 = .31333
Now that we have these values we can plug them in to find the Test Statistic.
Z – Test Statistic = .76−.65
√.68667∗.31333( 1
50 +
1
100 )
= 1.369
Now that we have the Z-Test Statistics we can use the =NORM.S.DIST function to
find the p-value.
And yes, we can have a negative Z- Test Statistic, if we do that is fine. You DO
NOT have to take the absolute value of anything. Use the Test Stat. as is in the
Excel function.
In Excel input =NORM.S.DIST(1.369,TRUE)
We will write out TRUE because this test is cumulative.
We see this p-value = .9145 BUT remember when we use this function in Excel,
this function is in the less than form. This means if we were running a Lower
Tailed test, this would be our p-value. BUT since we are running an Upper Tailed
Test we need to take 1 - .9145 to get the p-value for our test.
P-value = 1 - .9145 = .0855.
We see the p-value for our upper tailed test is .0855. If we compare this to .05,
we see that:
.0855 > .05. Since the p-value is greater than alpha, We Do Not Reject Ho. This
test is not significant and No, there is no evidence that the proportion of people
favoring the new proposal is greater in the developing section than the rest of the
district at alpha = .05.
What if we were running a two tailed test? To find this p-value we would take
whichever p-value is smaller and multiple it by 2.
.0855*2 = .171. The p-value for a two tailed test would be .171.
Now that we ran a hypothesis test, let calculate a confidence interval and draw
the same conclusion.
The equation for a 2 – sample proportion is:
𝑝1 − 𝑝2 ± 𝑍𝛼 2
∗ √
𝑝1𝑞1 𝑛1
+ 𝑝2𝑞2
𝑛2
Where Standard Error (SE) = √ 𝑝1𝑞1
𝑛1 +
𝑝2𝑞2
𝑛2
Margin of Error (ME) = 𝑍𝛼 2
∗ √
𝑝1𝑞1
𝑛1 +
𝑝2𝑞2
𝑛2
Plugging in what we know:
. 76 − .65 ± 𝑍𝛼 2
∗√ . 76 ∗ .24
50 +
. 65 ∗ .35
100
The last thing we need to find is the Z- Critical Value. We will use the
=NORM.S.INV function to find this. This function should look familiar from Week
4.
If we want to find a 95% confidence interval, then alpha = 1 - .95 = .05. But
because this is a confidence interval and we need to take into account the plus
AND minus on both sides if the bell-shaped curve we will divide alpha be 2. .05/2
= .025. Then we take 1 - .025 = .975. We will use this value in our Excel function.
=NORM.S.INV(.975)
We see the Z – Critical Value is 1.96. We will plug this into the equation and
solve.
. 76 − .65 ± 𝑍𝛼 2
∗√ . 76 ∗ .24
50 +
. 65 ∗ .35
100
. 76 − .65 ± 1.96√ . 76 ∗ .24
50 +
. 65 ∗ .35
100
. 76 − .65 ± 𝑍𝛼 2
∗√ . 76 ∗ .24
50 +
. 65 ∗ .35
100
. 76 − .65 ± 1.98(.076961)
. 11 ± .1508
(-.0408, .2608)
The confidence interval goes from -4.08% to 26.08%. This interval goes from a
negative value to a positive value. This means that 0 is in fact in this interval.
Because 0 is in the interval it is Not Significant, and we Do Not Reject Ho. This is
the same conclusion that we got with the hypothesis test.