# Chapter 9: Loglinear and Logit Models for Contingency Tables

### Summary

This chapter extends the model-building approach to loglinear and logit models. These comprise another special case of generalized linear models designed for contingency tables of frequencies. They are most easily interpreted through visualizations, including mosaic displays and effect plots of associated logit models.## Contents

- 9.1. Introduction
- 9.2. Loglinear models for frequencies
- 9.3. Fitting and testing loglinear models
- 9.4. Equivalent logit models
- 9.5. Zero frequencies
- 9.6. Chapter summary
- 9.7. Lab exercises

### Selected figures

view R code-
#### Figure 9.1

Standard errors of residuals, sqrt(1-h_i)idecrease with expected frequencies. This plot shows why ordinary Pearson and deviance residuals may be misleading. The symbol size in the plot is proportional to leverage, h_i. Labels abbreviate Department, Gender, and Admit, colored by Admit. -
#### Figure 9.2

Mosaic display for the model [AD][GD], showing standardized residuals for the cell contributions to G^2. -
#### Figure 9.3

Mosaic display for the model berk.glm3, allowing an association of gender and admission in Department A. This model now fits the data well. -
#### Figure 9.4

Observed (points) and fitted (lines) log odds of admissions in the logit models for the UCBAdmissions data. Left: the logit model Eqn. (9.16) corresponding to the loglinear model [AD] [AG] [DG]. Right: the logit model Eqn. (9.17), allowing only a 1 df term for Department A.