In Linear Regression Models for Comparing Means and ANOVA using Regression we studied regression where some of the independent variables were categorical. In this section we look at log-linear regression, in which all the variables are categorical. In fact log-linear regression provides a new way of modeling chi-squared goodness of fit and independence problems (see Independence Testing and Dichotomous Variables and Chi-square Test for Independence).
The model we will use is
where all the xij are dummy variables coded to represent categorical variables. In addition, we also consider more complicated models which contain factors consisting of interactions between these variables, as described in the sections listed below, and the yi are used to express the frequency of outcomes.
We will consider the cases where k = 2 or 3. The case where k = 2 corresponds to the two-way contingency tables studied in Independence Testing and re-examined in Two-way Contingency Tables. The case where k = 3 corresponds to three-way contingency tables, which are examined in Three-way Contingency Tables.
- Two-way contingency tables
- Three-way contingency tables