This tutorial explains how to perform the Chi-square test of independence in R and how to interpret its results.
The Chi-square test of independence tests whether there is a relationship between two categorical variables. The null and alternative hypotheses are:
- H0 : the variables are independent, there is no relationship between the two categorical variables. Knowing the value of one variable does not help to predict the value of the other variable
- H1 : the variables are dependent, there is a relationship between the two categorical variables. Knowing the value of one variable helps to predict the value of the other variable
The Chi-square test of independence works by comparing the observed frequencies (so the frequencies observed in your sample) to the expected frequencies if there was no relationship between the two categorical variables (so the expected frequencies if the null hypothesis was true).
You'll learn when to use a Chi-square test of independence, how to perform it in R, and how to interpret the results. Ask any questions related to the content for free!