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
What Sperm Whales Can Teach Us About Humanity | National Geographic
I can remember my earliest memories of my parents taking me to the beaches in New England where we lived and just wondering about the mysteries that lie beneath. I think the ocean for me has always represented this place of great potential discovery. As I…
Ben Huh on Therapy
My name is Benoit, and I’m the founder and former CEO of the Cheeseburger Network, and also co-founder of the news app Circa. Now, I work at Y Combinator on some special projects. I first started going to therapy about four or five years ago when I was g…
Having Hip Replacement Surgery: What to Expect
I, I, I need a hip replacement. For 32 years of playing squash, my right hip is killing me. I want to get back in the game. I’ve been avoiding it for two years. I could go anywhere. I could go to Abu Dhabi. I could go to Dubai. I can do anywhere in the Un…
How price controls reallocate surplus | APⓇ Microeconomics | Khan Academy
What we’re going to talk about in this video is the effect of price controls on changing how the surplus, the total surplus, is reallocated between consumers and producers. We already touched on this in other videos, the video on rent control, the video o…
Sine and Cosine come from circles
Now I’m going to clear off the screen here, and we’re going to talk about the shape of the sign function. Let’s do that. This is a plot of the sign function, where the angle Theta—this is the Theta axis in this plot—where Theta has been plotted out on a s…
Standard of deferred payment and legal tender
Hey everyone, So in the last couple videos, I was talking about various functions of money, and people usually list at least three different functions that it serves. The first is a medium of exchange; it’s what we use to trade for goods. The second is t…