Chi-square tests are useful for categorical data. They can be used to test whether a vector of probabilities associated with each of several possible outcomes is equal to some null value. That null value may be known (e.g., that all the probabilities are the same, meaning the outcomes are equally likely), or unknown. The latter case comes up often when testing the hypothesis of independence between two categorical variables or marginal homogeneity of a probability distribution across several categories (or strata). In those situations, the null probability vector is estimated from the data. Either way, the chi-square test compares the observed frequencies in a contingency table to expected frequencies, giving a test that has a large-sample chi-square distribution under the null hypothesis.
In this video, we illustrate the chi-square test that a set of outcomes are equally likely, as well as the chi-square test of marginal homogeneity in a two-way table. These illustrations are both from an example involving slot machine outcomes. You should open Mod13Script.R in RStudio and follow along with Examples 3 & 4 from that script while watching this video. Additional illustrations of the chi-square test of independence are featured in Example 5, which is not covered in this video, but which you are encouraged to read through on your own. That example also illustrates the prop.test() and fisher.test() functions.
This video is essential content for the course.