A test of whether two categorical variables are independent examines the distribution of counts for one group of individuals classified according to both variables, A chi sqr test of independence finds expected counts by assuming that knowing the marginal totals tell us the cell frequencies, assuming that there is no association between the variables. This turns out to be the same calculation as a test of homogeneity. We find a P-value from a chi-sqr distribution with (Rows - 1) x (#Cols - 1) degrees of freedom, where # Rows fives the number of categories in one variable and # colums gives the number of categories in the other