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
Synthetic Media: Virtual Influencers & Live Animation: Figments (S19) - YC Gaming Tech Talks 2020
My name is Jay Rosenkrantz. I’m the co-founder and CEO of Figments, with my brother Scott. As we’re building the next version of the WWE for esports, we went through YC Summer of 2019. I think one of the most fun and incredible things about this experienc…
Performing a rotation to match figures
Use one rotation to map quadrilateral ABCD to the other quadrilateral. So to map this one to this one right over here, use a number between 0 and 360° to describe the angle. Counterclockwise is positive, so you’re going to want to move it counterclockwise…
The BIGGEST Stimulus Check JUST RELEASED
What’s up you guys? It’s Graham here! So lately, I’ve had quite a few people bring this to my attention, so much so that I felt I should make a video about it explaining exactly what’s going on in the entire situation. Because when you see a title like th…
Building an Empire and Making Snow White | Jeremy Boreing | EP 389
I know that in Braveheart, William Wallace doesn’t achieve the goal. He’s executed; other people achieve the goal. I know that in the Pendragon Cycle, in turn, both Taliesin and Merlin and Arthur fail to achieve the goal. They get us one step closer to th…
Veteran reveals what America's wars say about the value of human life | Danny Sjursen
I’m really interested in this question and I’m glad you asked about it. This is a question of how do Americans value life? Is every life equally valuable to an American? I would argue it’s not, and there’s some evidence of that. We know precisely how man…
How I trained myself to focus long periods of time (even when I dont want to)
When I was in 8th grade, 7 years ago, I was preparing for the high school entrance exam. I wanted to score as high as possible so that I could get into my dream high school. But the problem was, I could only concentrate 5 minutes, literally. After 5 minut…