Main content

## Testing the difference between two proportions

Current time:0:00Total duration:9:19

# Hypothesis test for difference in proportions

AP Stats: DAT‑3 (EU), DAT‑3.D (LO), DAT‑3.D.1 (EK), VAR‑6 (EU), VAR‑6.H (LO), VAR‑6.H.1 (EK), VAR‑6.H.2 (EK), VAR‑6.H.3 (EK), VAR‑6.I (LO), VAR‑6.I.1 (EK), VAR‑6.K (LO), VAR‑6.K.1 (EK)

## Video transcript

- [Instructor] We're now going
to explore hypothesis testing where we're thinking about the difference between proportions of
two different populations. So here it says, here are the
results from a recent poll that involved sampling voters from each of two neighboring districts,
District A and District B, and folks were asked
whether they supported a new law or not, and from each district, we took a sample of 100 voters. And then we were able to
calculate the proportion from that sample that supported the law. And then here we have the combined data, including the combined proportion. And we're asked, does this suggest a significant difference
between the two districts. And so this is asking
for a hypothesis test, and the way we would do that is we would set up our null hypothesis, and remember our null
hypothesis is the one that we would assume that
there is no difference. So we would assume that the
true proportion of folks in District A that support
the new law is equal to the proportion in District
B that support the law. Or another way to think about it is that the difference would be equal to zero. And our alternative hypothesis is that the absolute difference between the proportions is not equal to zero. And if we were doing an
all out hypothesis test, we would set a significance level, which we usually denote with an alpha. Often times it might be
a 10% significance level or a 5% significance level. Let's say we set it at
a 5% significance level. And what we would do is, we would say, "All right, let's assume that
the null hypothesis is true, "and assuming the null hypothesis is true, "what is the probability of
getting a difference between our "sample proportions this extreme or more? "And if that probability is
less than our significance "level, then we reject
the null hypothesis, "which would suggest the alternative." Now before we go deeper
into our inference, we want to test our
conditions for inference, and we've seen these many times before. You have the Random condition, where you would need
to feel good that both of these samples are truly random. You would have your Normal condition, which is that you would
have at least 10 successes and failures in each of these samples, and we see that we do
indeed have at least 10 successes and at least 10
failures in each of those samples. And then you have your
Independence condition, and the Independence condition, you're either sampling with replacement or you need to feel good that
each of these sample sizes are no more than 10% of
the entire population, and so I guess we will assume that there's at least 1,000 folks in District A and at least 1,000 folks in District B and that will allow us to meet
the Independence condition. And so with that out of the way, let's assume the null hypothesis, and let's just start
thinking about the sampling distribution of the difference between the sample proportions
assuming that null hypothesis. So the first thing I wanna think about is what is going to be the standard deviation of the difference in the
sampling distributions. Well, we have seen in a previous video when we talked about
differences of proportions. We can think about the variance, so the variance of the
sampling distribution. There's a lot of notation here. So the variance, this
is going to be equal to the variance of the sampling distribution of the sample proportion from District A plus the variance of the sampling distribution of the sample proportion from District B. Now in general, you can
figure out the variance of the sampling distribution of a sample proportion with the following formula. We've seen this before. The variance of the sampling distribution of the sample proportion
is going to be equal to our true proportion times one
minus our true proportion, all of that over your sample size. Now in either situation, we don't know the true proportions for
District A or District B. That's why we are in this,
that's why we're even doing this hypothesis test to begin with. But we can try to estimate it. Remember, we're assuming that
the true proportions are equal even though we might
not know what they are. And what is going to be our best estimate of that true proportion if
we assume that District A and District B have no difference in terms of the number of people
who support the new law? Well the best estimate would actually be the combined sample, the combined sample proportion right over here. And so to estimate these values, we use this combined sample proportion in the place of P over here. So we could say that this is going to be our combined sample proportion times one minus our
combined sample proportion, all of that over our sample size. And since we're assuming
that there's no difference between District A and District B, this would also apply to
that right over there. So let me rewrite this again, the standard deviation of
the sampling distribution of the difference of
the sample proportions from District A and District
B is going to be roughly. Remember we weren't able
to calculate it exactly, but we're using this combined proportion as our best estimate. Let me do a big square root
right over here, a big radical. And so underneath that, we
are going to have our estimate of this, which is 0.55 times one minus 0.55, so 0.45, over 100 plus our estimate of this, which is 0.55. It's the same thing again. Times 0.45, and remember
that's because we're assuming the null hypothesis is true. All of that over this sample size. All of that over 100. And now we can get our calculator out to actually calculate it. And so we get the square root of 0.55 times 0.45 divided by 100. Now I could add that whole thing again or I could just multiply by two. So times two is equal to approximately 0.07. So this is going to be approximately equal to 0.07, and now using this, we
can calculate a z-score, and then we could think
about, what's the probability of getting a z-score that extreme or more. And so our z-score, or our z-value, would be equal to the
difference that we got. P hat sub A, minus P hat sub B, all of that over our estimate of the standard deviation of
the sampling distribution of the difference between
the sample proportions, so all of that over 0.07. Now this up here in
yellow, 0.58 minus 0.52, this is going to be equal to 0.06 over 0.07. 0.07. We can get our calculator
out for this again, and so we have 0.06 divided by 0.07 is going to be, it's approximately 0.86, so this is approximately 0.86. Now what's the probability of getting something this extreme or more extreme? Let me just make sure we
can visualize it properly. So if this is our sampling distribution of the difference between
our sample proportions, and we're assuming the null hypothesis, so the mean of our sampling distribution is going to be zero, is
going to be zero right there, we just got a result that is less than a standard
deviation above the mean. So we just got a result. So this is one standard deviation, two standard deviations above the mean. One standard deviation below the mean. Two standard deviations below the mean. We just got a result that is, that puts us right there, and if we asked ourselves,
what's the probability of getting result at least that extreme, we would say, okay, it would
be, what's the probability of getting a result all of
this area right over here, and would also be what's this area on the other side of the mean. And we know that this is over 30% because even if you just
exclude one standard deviation above and below the mean, if
you say anything more extreme than that, so if you put
this area and this area, you're looking at roughly 31 or 32%. So the probability of getting something at least this extreme
is going to be over 30%, and so it's definitely going to be higher than our significance level. It's actually completely reasonable to get a difference this extreme if we assume the null hypothesis is true. In future videos, we can go even deeper, where we can actually just look this up on a z-table to calculate
these areas more precisely, and we can compare them
to the significance level, but here it's not even close. We're nowhere close to being able to reject the null hypothesis. So to answer the question,
does this suggest a significant difference
between the two districts? No, no it doesn't.

AP® is a registered trademark of the College Board, which has not reviewed this resource.