To determine whether two categorical variables are independent, using the data from a contingency table, we use a χ2 test for independence. The hypotheses take the form
H0:Variable A and Variable B are independent.
Ha:Variable A and Variable B are dependent
The χ2 test for independence is performed using the critical-value method and the p-value method. The observed frequencies are compared with the expected frequencies on the assumption that H0 is correct. Large differences lead to the rejection of the null hypothesis.
The k-sample test, called the test for the homogeneity of proportions, determines whether all k population proportions are equal. The result uses a test statistic that follows a χ2 distribution. The null hypothesis for the k-sample test assumes that all k population proportions are equal. The alternative hypothesis states that not all the population proportions are equal. When performing the test for the homogeneity of proportions, the same steps are used as for the χ2 test for independence.