Correspondence analysis maps and association graphs

Mosaic plots show the cells of a table. Two complementary displays summarize the associations themselves:

Correspondence analysis: imcaplot()

Simple correspondence analysis

For a two-way table with relative frequencies \(p_{ij}\) and margins \(r_i\), \(c_j\), correspondence analysis is the singular value decomposition \[\frac{p_{ij} - r_i c_j}{\sqrt{r_i c_j}} = \sum_k \sigma_k u_{ik} v_{jk}.\] The squared singular values \(\sigma_k^2\) are the principal inertias; their sum is Pearson’s \(X^2 / N\). The rows are plotted at \(f_{ik} = \sigma_k u_{ik} / \sqrt{r_i}\) and the columns at \(g_{jk} = \sigma_k v_{jk} / \sqrt{c_j}\) (principal coordinates). Each dimension accounts for \(\sigma_k^2 / \sum \sigma^2\) of the association.

imcaplot(margin.table(HairEyeColor, 1:2), main = "Hair and eye colour: simple CA",
         height = 520)

The first dimension (about 90% of the inertia) runs from dark (black hair, brown eyes) to fair (blond hair, blue eyes). The second separates red hair and green or hazel eyes.

Multiple correspondence analysis

With three or more variables imcaplot() computes a multiple correspondence analysis from the Burt matrix, the table of all two-way margins. The coordinates are those of the indicator-matrix analysis. The percentages of inertia are Greenacre’s adjusted ones, the default of ca::mjca() and of vcdExtra::mcaplot(), because the unadjusted percentages of MCA are much too pessimistic. The same results are obtained with ca::mjca(), and mjca and ca objects can also be passed to imcaplot().

imcaplot(HairEyeColor, main = "Hair, eye colour and sex: MCA", height = 560)

Interactions in the map:

Association graphs: iassoc_graph()

A hierarchical log-linear model is described by its generating class, the maximal sets of variables that interact. For example, [Admit Dept][Gender Dept] says that admission and gender are each associated with the department but are conditionally independent given it. The association graph (Whittaker, 1990; vcdExtra::assoc_graph()) has one node per variable and an edge between two variables when they appear together in a term. Two variables with no edge between them are conditionally independent given all the other variables.

iassoc_graph() draws this graph interactively and compares several models:

Models are fitted by iterative proportional fitting (stats::loglin()), which handles sampling zeros, frequent in tables such as Titanic.

iassoc_graph(UCBAdmissions, models = list(
  "[AD][GD]" = ~ Admit * Dept + Gender * Dept,
  "[AD][AG][GD]" = ~ (Admit + Gender + Dept)^2,
  "[AGD]" = ~ Admit * Gender * Dept), initial = 2,
  main = "UC Berkeley admissions", height = 480)

In the model of no three-way interaction, [AD][AG][GD], the Admit–Gender edge is thin and not significant (\(\Delta G^2 \approx 1.5\) on 1 df). Once the department is accounted for, gender adds nothing to the prediction of admission. Tick show marginal associations to see that the marginal Admit–Gender association is weak too, but highly significant because of the large sample.

iassoc_graph(Titanic, models = list(
  "joint", "conditional",
  "Survival ~ Class + Sex + Age" =
    ~ Class * Sex * Age + Survived * (Class + Sex + Age),
  "Survival ~ Class*Sex + Class*Age" =
    ~ Class * Sex * Age + Survived * (Class * Sex + Class * Age)),
  main = "Titanic", height = 520)

References