8.12: Hypothesis Test for Test of Independence
The test of independence is a chi-square-based test used to determine whether two variables or factors are independent or dependent. This hypothesis test is used to examine the independence of the variables. One can construct two qualitative survey questions or experiments based on the variables in a contingency table. The goal is to see if the two variables are unrelated (independent) or related (dependent). The null and alternative hypotheses for this test are:
H0: The two variables (factors) are independent.
H1: The two variables (factors) are dependent
First, one identifies the observed frequencies and calculates the expected frequencies. The expected frequency of each entry is obtained by multiplying the row total and column total and dividing it by the sum of all the frequencies. Then the test statistic is calculated using observed frequency values from the contingency tables and the calculated expected frequencies. Then with the help of the chi-square table, the critical values in a one-tailed test with suitable confidence levels are calculated. If the test statistic is larger than the critical value and falls in the critical region, the null hypothesis is rejected; otherwise, it is accepted.
This text is adapted from Openstax, Introductory Statistics, Section 11.5, Comparison of the Chi-Square Tests.