WALTER PECK: Hi, again. So let's say you decided that your data are not quantitative, like a measurement of weight or something like that, with a mean and a standard deviation. But instead, that your data in your study are qualitative, categorical, like black or blue, or black, blue, or red, or large or small, or, in this case, heart attack or no heart attack.
What I'm going to do with this study is I'm going to propose that there's some medication which some pharmacological firm wants to market to reduce the chance of heart attacks. So what they're going to do is they're going to give this medication to 100 people, and then they're going to have a similar group of another 100 people, which is hopefully a random sample, and they're identical in all ways other than whether or not they get the medication.
Then they're going to watch these folks. It doesn't matter how long. Let's pretend five years. And during that five years, the folks that get the medication, well, they're either going to have a heart attack or they're not going to have a heart attack. The people in the control group, the people not getting the medications, either heart attack or not heart attack.
And I just simply made up these numbers. And you can see that I set it up in such a way that it looks like the medication has reduced the heart attack rate, but we can't be sure. We want to be sure. Well, as far as possible we want to be sure. And we want to know what kind of confidence we can have that the difference is real.
To do that, we do something called a chi-square test. That capital X-looking thing is a Greek letter for their letter chi, which is a ch, not an x. Anyway, so there we go. We're going to do a chi-square test. Notice I also threw in a couple of lines at the right and bottom totaling things up. 50 total individuals got a heart attack. 150 got no heart attack, for a total of 200. 100 in each of the categories for a total of 200. And those are going to be important in a few minutes.
As in any statistical test, you're going to have two alternative hypothesis. I shouldn't have said it quite that way-- two hypotheses, one of which is called the null hypothesis and one of which is called the alternative hypothesis. The null hypothesis is basically that there's no effect. It's like if you're doing a study of size, that the sizes of two different samples are going to be the same. Or if you're doing a medication, that the medication has no effect.
I know the pharmacological company wants to have this be effective. So it seems strange that we're testing the null hypothesis, but that's the way that it works. So the null hypothesis is that the medication has no effect. The same proportion of people in the sample who had the medication and do not have the medication end up getting heart attacks. That's the null hypothesis.
The alternative hypothesis is the idea that the medication does have an effect. Now, hopefully it's the effect that it increases-- or I should say decreases the rate of heart attack, increases the rate of survival. But that's the alternative hypothesis.
So you can see that the alternative and null hypotheses are opposites of one another. If you reject the alternative, you accept the null. If you reject the null, you accept the alternative.
So now let's look at what kinds of errors that can happen in a test like this. Well, there are two basic kinds of errors. There's a type I error, which is where you reject a true H0. That means that you think there's a difference when there's not.
The type II error is the exact opposite. You reject a true Ha. In other words, you think there is no difference when there really is. You can see that if you increase the possibility of a type II error, you decrease the possibility of type I error and vice versa. You can't eliminate error altogether.
We're going to be talking a lot about levels of significance in a few minutes on the chi-square test. And to be honest with you, that's some quantification of type I error. Keep in mind that what level of error you're willing to put up with depends upon the kind of test you're doing.
Again, this company wants to be very sure that they are not hurting people, so they're going to set up a significance level that eliminates, as much as possible, the chance that they randomly hurt folks with this medication.
So now let's look back at our numbers-- 15, 35, 50, 85, 65, 150, 100, 100, 200. How do we take these numbers and convert them into a number in the chi-square test that lets us decide whether to accept or to reject the null hypothesis?
Well, let's take a look now at the chi-square equation. It's a relatively simple equation. The chi-squared statistic-- so you know, it's both chi-square and chi-squared. I've seen it both ways. It doesn't matter which way you go. Apparently, legitimate statisticians use it both ways.
Chi-squared is equal to the sum of observed minus expected quantity squared over expected. Let me say that again. Chi-squared is the sum of the observed minus the expected quantity squared over the expected. So the expected and the observed, what are they? Well, the observed are the actual numbers that you have for each of your quadrants.
So this one here, the observed is 15. Observed is 85, 35, and 65. I want to make sure you realize as we do the chi-square test here, you could have done a two-by-three matrix or a two-by-four matrix. It doesn't matter. We're just a two-by-two matrix. That's the simplest type of test. So now let's go back here to my table. So there's my observeds, 15, 85, 35, 65, those four quadrants in our matrix. Now let's get the expecteds.
Remember, our null hypothesis is that the medication has no effect upon the rate at which heart attacks happen. So that's saying basically that if 50 people have heart attacks overall out of 200 total, that proportion, 50/200, is 0.25, 25%, is true both for the no-medication sample and the medication sample. So 0.25 get a heart attack overall. So 0.25 of 100 is 25. So the expected right here is 25.
Same thing over here. 0.25 get a heart attack out of 100. 0.25 of 100 is 25. And also down here, no heart attack. Well, 150/200 is 0.75, 3/4. So 0.75 of 100 is 75 and 75. Notice they add up to 100, 100, just like you would expect.
So we've got our observeds. We've got our expecteds. Is the difference between the observeds and the expecteds big enough for us to conclude that there's a difference in heart attack rates for having the medication? Well, let's do the calculations.
So the expecteds, remember we had 15 was 25; 85, 75, all the way down. That'll stray from that table that we saw a few minutes ago. The observed minus the expected, well, that's 10, 10, 10, 10. It doesn't really matter about the negatives. I'll throw them in there. They're going to disappear in a second.
So observed minus expected squared. Negative 10 squared is 100. 10 squared is 100. Down we go. Observed minus expected quantity squared over expected. Well, let's look at the first line. That's observed minus expected squared, 100, divided by the expected. 100 divided by 25 is 4. And they just keep going down doing that. Observed minus expected squared over expected is 1.33, and we go all the way down.
In a second, you're going to see what's important is what the sum of all these guys is. And that is our chi-squared statistic. Our chi-squared statistic is the sum of all those observed minus expected quantity squared over expected, that last column. I got the number of 10.66. So that's my chi-squared statistic.
The question is, what does that tell us? The first thing we need is a degrees of freedom. The degrees of freedom is equal to the number of columns in our matrix minus 1 times the number of rows in our matrix minus 1. Well, we have a very simple matrix, just two by two. There's just two categories on both the independent and dependent variable sides. So it's 2 minus 1 times 2 minus 1, 1 times 1, or 1 degree of freedom.
OK. So we go to the line that says 1 degree of freedom, and we are willing to go to a 0.05 critical level. A 0.05 critical level means that there's a 5% chance that the difference between medications and no medications happened randomly even if having a medication had no effect. In other words, there's a 5% chance that your study is finding a difference that doesn't really exist. That's the type I error, rejecting a true H0. In other words, finding a difference when there is none.
Our t-statistic was 10, large t-statistic. It's bigger than the critical value. So that difference between the observed and the expected values-- remember, the observed and the expected values were what we got and what we expected if there was no effect of the medication.
And that's a pretty darn big difference if you just look at it qualitatively with your eyes. That's a really big difference. We ended up getting a really large chi-square value, over 10. That number is so big that we are 95% confident, because it's bigger than the 3.841, the critical value there, we are 95% confident plus that the difference is real and didn't happen from random effects.
Let's go over here. Here's the 0.1 level of significance, 99% confidence. That value is 6.635. We're even above that. So we're really confident that the difference is real, that it didn't happen just according to chance.
We've received your request
You will be notified by email when the transcript and captions are available. The process may take up to 5 business days. Please contact firstname.lastname@example.org if you have any questions about this request.
As part of the NIH-funded ASSET Program, students and teachers in middle and high school science classes are encouraged to participate in student-designed independent research projects. Veteran high school teacher Walter Peck, whose students regularly engage in independent research projects, presents this series of five videos to help teachers and students develop a better understanding of basic statistical procedures they may want to use when analyzing their data.