Suppose that each student in a sample had been categorized with respect to political views, marijuana usage, and religious preference, with the categories of this latter factor being Protestant, Catholic, and other. The data could be displayed in three different two-way tables, one corresponding to each category of the third factor. With pijk = P(political category i, marijuana category j, and religious category k), the null hypothesis of independence of all three factors states that \(p_{ijk}=p_i..p_j..p_k\)

Let nijk denote the observed frequency in cell (i, j, k). Show how to estimate the expected cell counts assuming that H0 is true (\(\widehat{e}_{ijk}=n\widehat{p}_{ijk}\), so the \(\widehat{p}_{ijk}\)’s must be determined). Then use the general rule of thumb to determine the number of degrees of freedom for the chi-squared statistic.