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

Chi-square goodness-of-fit example | AP Statistics | Khan Academy


4m read
·Nov 11, 2024

In the game Rock Paper Scissors, Kenny expects to win, tie, and lose with equal frequency. Kenny plays Rock Paper Scissors often, but he suspected his own games were not following that pattern. So he took a random sample of 24 games and recorded their outcomes. Here are his results: out of the 24 games, he won four, lost 13, and tied seven times. He wants to use these results to carry out a chi-squared goodness of fit test to determine if the distribution of his outcomes disagrees with an even distribution.

What are the values of the test statistic, the chi-squared test statistic, and p-value for Kenny's test? So pause this video and see if you can figure that out.

Okay, so he's essentially just doing a hypothesis test using the chi-square statistic because it's a hypothesis that's thinking about multiple categories. So what would his null hypothesis be? Well, his null hypothesis would be that he has that all the outcomes are equal probability outcomes—equal, equal probability.

Then his alternative hypothesis would be that his outcomes have not equal probability. Remember, we assume that the null hypothesis is true, and then assuming if the null hypothesis is true, the probability of getting a result at least this extreme is low enough, then we would reject our null hypothesis. Another way to think about it is if our p-value is below a threshold, we would reject our null hypothesis.

What he did is he took a sample of 24 games, so n is equal to 24, and then this was the data that he got. Now, before we even calculate our chi-square statistic and figure out what's the probability of getting a chi-square statistic that large or greater, let's make sure we meet the conditions for inference for a chi-squared goodness-of-fit test.

You've seen some of them, but some of them are a little bit different. One is the random condition. I'll write them up here: the random condition would be that this is truly a random sample of games, and it tells us right here he took a random sample of his 24 games, so we meet that condition.

The second condition, when we're talking about chi-squared hypothesis testing, is the large counts condition. This is an important one to appreciate. This is that the expected number of each category of outcomes is at least equal to five. Now, you might say, "Hey, wait, I only got four wins," or "Kenny only got four wins out of his sample of 24," but that does not violate the large counts condition.

Remember, what is the expected number of wins, losses, and ties? Well, if we're assuming the null hypothesis where the outcomes have equal probability, so the expected... I could write right over here, it would be that it's one-third, one-third, one-third, and so one-third of 24 is 8, 8, and 8. That's what Kenny would expect, and since all of these are at least equal to 5, we meet the large count condition.

Then, the last condition is the independence condition. If we aren't sampling with replacement, then we just have to feel good that our sample size is no more than 10 percent of the population. He can definitely play more than 240 games in his life, so we would assume that we meet that condition as well.

So with that out of the way, we can actually calculate our chi-squared statistic and try to make some inference based on it. Our chi-squared statistic is going to be equal to... For each category, it's going to be the difference between the expected and what he got in that sample, squared, divided by the expected.

So the first category is wins; that's going to be 4 minus 8, squared, over an expected number of wins of 8, plus losses. That's 13 minus 8; 13 is how many he got—how many he lost—minus 8 expected, squared, all of that over 8.

So let's see, what is this? Four minus eight is negative four. You square that, you get sixteen. Thirteen minus eight is five; you square that, you get 25. Seven minus 8 is negative 1; square that, you get 1.

Sixteen divided by 8 is going to be 2. Twenty-five divided by 8 is going to be, let's see, that's 3 and 1/8, so that's 3.125. And then 1 divided by 8 is 0.125. You add these together; so let's see, it's going to be 2 plus 3.125, which is 5.125, plus another 0.125, so that's going to be 5.25.

So our chi-squared statistic is 5.25. Now, to figure out our p-value, our p-value is going to be equal to the probability of getting a chi-square statistic greater than or equal to 5.25. You could use a chi-squared table for that, and we always have to think about our degrees of freedom.

We have one, two, three categories, so our degrees of freedom is going to be one less than that, or three minus one, which is two. So our degrees of freedom is going to be equal to two, and that makes sense because, you know, for a certain number of games, if you know the number of wins and you know the certain number of losses, you can figure out the number of ties, or if you know any two of these categories, you can always figure out the third.

So that's why you have two degrees of freedom. Let's get out our chi-squared table. We have 2 degrees of freedom, so we are in this row, and where is 5.25? So 5.25 is right over there, and so our probability is going to be between 0.10 and 0.05.

So our p-value is going to be greater than 0.05 and less than 0.10, and so, for example, if ahead of time—and he should have done this ahead of time—he set a significance level of five percent, and our p-value here is greater than five percent, which we just saw, he would fail to reject in this situation the null hypothesis.

But they're not asking us that here; all they're asking us is what is our chi-squared value and what range is our p-value in? Well, let's see; 5.25 are both of these values, and we saw we got a p-value between 5 and 10, so it is choice A right over there.

More Articles

View All
Think Tank! - Smarter Every Day 11
Hello my friends! Hey, it’s me Destin. I’m at the ordnance museum; let’s go learn something. I’m just kidding! This is a Russian tank, a T-34. Hey, this is the first tank, or actually the first vehicle to be called “tank.” This is the um, the Mark 4. The…
Anti-Gravity Wheel Explained
Standing on the scale. The wheel is spinning and it still weighs 92 kilograms. You made the prediction. Let’s see what happens when I throw it up over my head in three, two, one. What do you think? I don’t know about you, but to me, it looked like a shaky…
Worst Nuclear Accidents in History
Nuclear energy creates an uneasy feeling of danger for many people. Ancient and dangerous minerals are concentrated to awaken seemingly unnatural powers, creating horribly toxic elements that, if they escape, can and have killed people in horrible ways. H…
Interpreting computer regression data | AP Statistics | Khan Academy
In other videos we’ve done linear regressions by hand, but we mentioned that most regressions are actually done using some type of computer or calculator. So, what we’re going to do in this video is look at an example of the output that we might see from …
Return from the Okavango in 360 - Ep. 4 | The Okavango Experience
This is a place filled with magic. Everything has to have a reason: the movement of the grass, the core of an animal, the call of a bird. Everything, we’re connected to all of it, and that is the most alive we can ever be. This is a sanctuary for these in…
Article VI of the Constitution | National Constitution Center | Khan Academy
Hi, this is Kim from Khan Academy, and today I’m learning more about Article 6 of the US Constitution. Article 6 is, as we’ll soon see, kind of a constitutional grab bag. It covers debts, religious tests for office, and it establishes the Constitution as …