yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Hypothesis test for difference in proportions | AP Statistics | Khan Academy


6m read
·Nov 11, 2024

We're now going to explore hypothesis testing when 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. Folks were asked whether they support a new law or not. 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. Here we have the combined data, including the combined proportion, and we're asked, does this suggest a significant difference between the two districts?

This is asking for a hypothesis test, and the way we would do that is we would set up our null hypothesis. 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. Another way to think about it is that the difference would be equal to zero. Our alternative hypothesis is that the absolute difference between the proportions is not equal to zero.

If we were doing an all-out hypothesis test, we would set a significance level, which we usually denote with an alpha. Oftentimes it might be a ten percent significance level or a five percent significance level. Let's say we set it at a five percent significance level. What we would do is say, all right, let's assume that the null hypothesis is true. Assuming the null hypothesis is true, what is the probability of getting a difference between our sample proportions this extreme or more? 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. 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. We see that we do indeed have at least 10 successes and at least 10 failures in each of those samples.

Then you have your independence condition. In the independence condition, you are 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. So, I guess we will assume that there's at least a thousand folks in District A and at least a thousand folks in District B. That would allow us to meet the independence condition.

With that out of the way, let's assume the null hypothesis and start thinking about the sampling distribution of the difference between the sample proportions, assuming that null hypothesis. The first thing I want to 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 that we could think about the variance. The variance of the sampling distribution—there's a lot of notation here—so the variance 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 1 minus our true proportion, all of that over your sample size.

In either situation, we don't know the true proportions for District A or District B. That's why we're 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. 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, the best estimate would actually be the combined sample, the combined sample proportion right over here.

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 1 minus our combined sample proportion, all of that over our sample size. 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.

So underneath that, we're going to have our estimate of this, which is 0.55 times 1 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. Remember that's because we're assuming the null hypothesis is true, all of that over this sample size, all of that over 100.

Now we can get our calculator out to actually calculate it. 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 2. So times 2 is equal to approximately 0.07. So this is going to be approximately equal to 0.07.

Using this, we can calculate a z-score and then we can think about what's the probability of getting a z-score that extreme or more. Our z-score or our z-value would be equal to the difference that we got (p hat sub A - p hat sub B) all of that over our estimate of the standard deviation of the sampling distribution of this difference between the sample proportions, so all of that over zero point.

Now, this up here in yellow, it's 0.58 minus 0.52. This is going to be equal to 0.06 over 0.07. We can get our calculator out for this again. So we have 0.06 divided by 0.07 is going to be 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, the mean of our sampling distribution is going to be 0. It’s going to be 0 right there.

We just got a result that is less than a standard deviation above the mean. So we just got a result that puts us right there. If we ask ourselves what's the probability of getting a 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 it would also be what’s this area on the other side of the mean.

We know that this is over 30 because even if you just exclude one standard deviation above and below the mean, if you see anything more extreme than that—so if you put this area and this area—you’re thinking you're looking at roughly 31 or 32 percent.

So the probability of getting something at least this extreme is going to be over 30. 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.

More Articles

View All
Lecture 5 - Competition is for Losers (Peter Thiel)
All right, all right, good afternoon. Uh, today’s speaker is Peter Thiel. Peter was the founder of PayPal, Palantir, and Founders Fund, and has invested in, uh, most of the tech companies in Silicon Valley. And he’s going to talk about strategy and compet…
How to Use Pre-suasive Tactics on Others – and Yourself | Robert Cialdini | Big Think
Pre-suasion is the process of arranging for an audience to agree with your message before they encounter it. Now that might sound like some form of magic, but it’s not; it’s established science. Very often, we can use pre-suasive tactics, even other kinds…
2015 Maps of Meaning Lecture 02b: Object and Meaning (Part 2)
One person who visited me during the break had a question that was good. Not that all the other questions weren’t good, but this one is a question of good general relevance. So do you want to repeat your question? Even if they don’t know who the top of t…
Can you solve the giant spider riddle? - Dan Finkel
Once every century, the world’s greatest spiders gather to compete in a series of grueling games. The winner will become the next arachnomonarch, able to command all the world’s spiders to their will. That day is today, and for the first time, you’re cast…
Explicit Laplacian formula
So let’s say you have yourself some kind of multivariable function, and this time let’s say it’s got some very high dimensional input. So X1, X2, on and on and on, up to, you know, X sub n for some large number n. Um, in the last couple videos, I told yo…
2015 AP Chemistry free response 5a: Finding order of reaction | Chemistry | Khan Academy
[Voiceover] Blue food coloring can be oxidized by household bleach, which contains hypochlorite ion, or OCI-, to form colorless products, as represented by the equation above. So we have this equation where we have blue food coloring, which has this chemi…