From the course: Introduction to jamovi

Chi-square test of association - jamovi Tutorial

From the course: Introduction to jamovi

Chi-square test of association

- [Instructor] If you want to look at the association between two categorical or nominal variables, the most common choice is the chi-squared test of association. Also called the chi-squared test of independence. And let me demonstrate how this works by starting with a split frequency. Let's come up here to Exploration and Descriptives. And let's look at for instance, PsychRegions. This is in the State Data dataset that I supplied. I'm going to put that here under Variables, but let's split it by whether a state has a Republican or Democratic governor. Cause it's possible that there is some association between the political party of the governor and the state's personality as rated by some researchers. Now, right now all it's telling us is that there are 48 cases in the data. I'm going to remove this extra information that I don't need. There I go, now the table's a little bit smaller. I do want to get a frequency table. I'll click on that. And this is going to tell me how many people, or really, how many states there are in each combination. And then I'll also ask for a bar plot at the same time. And what we have here is that we have 20 Republican governors of states that are considered friendly and conventional. We have six Democratic governors of states that are considered temperamental and uninhibited. And we can see that in the chart down here, again I apologize for the overlapping labels. I'm sure that'll be fixed in a later version. The blue lines are Democrats and the yellow gold ones are Republicans. And what you see is this huge spike in terms of friendly and conventional, the vast majority of those states have Republican governors. Where the other ones appear to be somewhat split, a little more Republicans in the temperamental and uninhibited. But let's find out whether this difference is statistically significant. Whether there is, in fact, a statistical association between the personality of the state and whether the governor is Democrat or Republican. So, we'll use the chi-squared test of association for that. Let's come up here and go to Frequencies. And then I come down here to Independent Samples. What that means is we have different groups of people in each of these categories or different groups of states. And it's chi-squared test of association also called the test for independence. And I'll click on that. And here's what it's going to ask me. I need to give it the rows and the columns for what's called a contingency table. That's just a table of rows and columns. So I'm going to start by putting PsycheRegion as the rows. And I'm going to put governor as the columns. That will mirror the table that I already created. And I could add extra layers, but that gets really complicated and hard to interpret. And what that would mean, by the way, is putting in another categorical variable here. So we'd end up with a three-dimensional table. But you don't want to deal with that, it's too hard. We have a choice for statistics. Chi-squared is just fine for what I have here. These ones, the comparative measures including the confidence intervals only apply when you have what's called a two-by-two table, and that means two rows and two columns. We have three rows and two columns, so these ones don't apply to what we're doing. We have some other choices. We can get a contingency coefficient or a phi and Cramer's V. Let's hit a contingency coefficient and that's like a correlation coefficient here at the bottom. We can do some ordinal statistics. We have categorical data not ordinal, so I'm going to leave that alone. And then we have some choices about what we put in the table. Now, right now what we have are just observed frequencies. The number of states that fall into each combination. We can also put expected frequencies, and that's important because that's what the chi-squared test is comparing these observed values to. So for instance, up here in Friendly and Conventional, we have four states with Democrat governors. But if the data were completely randomly distributed, it would be 7 1/2. On the other hand, down here we have 8 states that are temperamental and uninhibited and have Republican governor. But we would expect if things were random to have 9.63. The way it gets that by the way, is by multiplying the column totals by the row totals, and then dividing by the grand total for each of the cells. But the important part stays the same. Down here we have our chi-squared test, and we get a value of chi-squared of 4.89, with two degrees of freedom. We have a probability value of 0.087. Now, that's something that's not very likely to happen by chance, but because it's greater than the standard cutoff of 0.05, we conclude that even with this really big difference right here, that these results are not statistically different from what we would expect through random variation. So, even though it looks like there's a big difference, it doesn't hold up under null hypothesis testing. And that's one of the values of doing the chi-squared test. Even something that looks at eyeball level like a big result, when you do the actual numbers and get the inferential test, it may tell you a different story, which is exactly what happened in this situation.

Contents