Skip to main content
v2026.11,986 entries · CC-BY 4.0

Correspondence Analysis: Contingency Table Maps, Inertia and R/Python

How correspondence analysis maps a contingency table: formula, worked inertia example, reading rules, APA reporting and R/Python code.

Written and maintained by CASRAI Editorial Board

Published

On this page

Correspondence analysis (CA) is a descriptive method that turns a two-way contingency table of counts into a low-dimensional map. Rows and columns are plotted together, so rows with similar profiles land near each other, as do columns with similar profiles. Total inertia, which equals the table’s chi-square statistic divided by the grand total, measures how strongly the table departs from independence, and each axis takes a share of it.

Definition: what correspondence analysis does

Simple correspondence analysis works on one table of non-negative counts with rows and columns that are categories, for example career stage by preferred analysis software. The R function MASS::corresp is documented as computing the principal canonical correlation and the corresponding row and column scores from a simple correspondence analysis of a two-way contingency table. FactoMineR’s CA() returns eigenvalues with their percentage and cumulative percentage, plus coordinates, cos2, contributions and inertia for rows and columns.

The method has older roots than its current name: Hirschfeld (1935) is the usual earliest reference, and Benzécri’s school developed it in France in the 1960s and 1970s (his handbook is cited in the FactoMineR documentation). It is exploratory: it describes which categories go together and does not test a hypothesis. A chi-square test of independence (see the chi-square test guide) answers the yes/no question, and CA shows where the departure sits.

Formula: profiles, masses, standardized residuals and inertia

Let C be the m × n table of counts and nC its grand total. The steps below follow the standard presentation (Greenacre 1993; Benzécri 1992).

  1. Correspondence matrix. P = C / nC, so every cell is a proportion of the grand total.
  2. Masses. Row masses ri are the row sums of P, and column masses cj are the column sums. Their outer product r c′ holds the proportions expected under independence.
  3. Standardized residuals. Sij = (pij − ricj) / √(ricj).
  4. Singular value decomposition. S = U Σ V′, where Σ is the diagonal matrix of singular values σk.
  5. Principal inertias. Each axis k carries σk² of the inertia. Total inertia is Σσk² = ΣΣ Sij², which equals χ² / nC.
  6. Principal coordinates. Row coordinates F = Dr−1/2 U Σ and column coordinates G = Dc−1/2 V Σ, where Dr and Dc are the diagonal matrices of masses.

The number of non-trivial axes is at most min(m, n) − 1, because the table’s margins remove one dimension. The distance between two row points on the map is the chi-square distance between their row profiles; it is not the chi-square statistic itself.

Worked example with the arithmetic shown

The counts below are an illustrative composite invented for this guide, not survey data: 180 respondents classified by career stage and by the analysis software they use most. Rows are 60 respondents each, so the row masses are all 1/3.

Career stage R Python SPSS Row total
Doctoral students 30 20 10 60
Postdocs 15 25 20 60
Faculty 5 15 40 60
Column total 50 60 70 180

Step 1: masses and expected counts

Column masses are 50/180 = 0.2778, 60/180 = 0.3333 and 70/180 = 0.3889. Expected count = row total × column total / 180, so the R column expects 60 × 50 / 180 = 16.67 in every row, Python expects 60 × 60 / 180 = 20, and SPSS expects 60 × 70 / 180 = 23.33.

Step 2: chi-square and total inertia

Summing (observed − expected)² / expected over the nine cells gives 10.667 + 0 + 7.619 (doctoral), 0.167 + 1.250 + 0.476 (postdoc) and 8.167 + 1.250 + 11.905 (faculty), so χ² = 41.50 with (3 − 1)(3 − 1) = 4 degrees of freedom. Total inertia = 41.50 / 180 = 0.2306, and Cramér’s V = √(0.2306 / 2) = 0.34 (see Cramér’s V).

Step 3: axes

The singular value decomposition of the standardized residual matrix gives σ1 = 0.4646 and σ2 = 0.1213. The principal inertias are therefore 0.2158 and 0.0147, which sum to 0.2306, matching χ² / n. Axis 1 holds 93.6% of the inertia and axis 2 holds 6.4%. With three rows and three columns the table can have at most min(3, 3) − 1 = 2 axes, so this map is complete in two dimensions.

The data table below lists the mass, both principal coordinates, inertia and contribution to axis 1 for all six points, computed with the code in the Python section.

Interpretation: how to read a correspondence analysis map

On axis 1, doctoral students (−0.544) and R (−0.606) sit at one end and faculty (0.591) and SPSS (0.531) at the other, with postdocs and Python close to the centre. That reproduces what the table shows: R use falls and SPSS use rises from doctoral to faculty. Axis 2 explains only 6.4% of the inertia and mostly separates the middle category (postdocs, Python) from the two ends. The standardized residuals confirm it (R among doctoral students +3.27, SPSS among faculty +3.45, R among faculty −2.86).

What you see How to read it Source basis
Eigenvalue and percentage per axis The share of total inertia the axis explains; axes are ordered from largest to smallest. FactoMineR CA() returns eig with eigenvalue, percentage and cumulative percentage
Two row points close together Their row profiles are similar. Row distances are chi-square distances between profiles (Greenacre 1993)
A row point close to a column point Treat as a hint to check against the table, not as a measured distance. Look at the counts or the standardized residuals. MASS documentation: the biplot has no meaningful inner-product relation between row and column scores
Point far from the origin Its profile differs from the average profile. The origin is the average profile under independence (Greenacre 1993)
Contribution and cos2 columns Contribution shows which points built an axis; cos2 shows how well an axis represents a point. FactoMineR output components contrib and cos2
Sign of a coordinate Arbitrary; flipping an axis changes nothing. MASS documentation notes that signs vary by platform

Assumptions and common mistakes

  • Input is a table of counts, or something that behaves like one. Non-negative frequencies with categories as rows and columns; the method divides by row and column totals, so a row or column with a total of zero must be dropped first.
  • Reading row-to-column distances literally. MASS’s documentation states there is no useful inner-product relation between row and column scores in a two-dimension biplot, so interpret each set of points against itself and use the table for the cross-reading.
  • Treating the map as a test. CA is descriptive. A map is produced whether or not the chi-square test is significant, so report the test separately.
  • Reading only two axes by habit. Check the eigenvalue percentages first. If two axes capture a small share of inertia, a flat map hides structure.
  • Over-reading points with a tiny mass. Rare categories can sit far from the origin and have little weight; check their contribution values before explaining them.
  • Confusing the chi-square statistic with the chi-square distance. Total inertia is χ² / n; the map distances are between profiles.

How many dimensions does a correspondence analysis have?

At most min(m, n) − 1 non-trivial dimensions for an m × n table, here two. In FactoMineR the ncp argument (default 5) sets how many dimensions to keep, and in MASS::corresp the nf argument sets the number of factors (default 1; a biplot needs nf of 2 or more).

Correspondence analysis versus multiple correspondence analysis

Simple CA handles one cross-tabulation of two variables. Multiple correspondence analysis (MCA) extends the idea to several categorical variables at once and was popularised in the social sciences by Bourdieu’s Distinction (1984). The table you give simple CA must already be a cross-tabulation. For continuous plus categorical variables together see factor analysis of mixed data, and for how a PCA-style map is read see the principal component analysis plot guide.

How to report correspondence analysis (APA example)

Report the table, the test, the effect size and the share of inertia on the axes you interpret. Illustrative wording for the example above: A chi-square test showed that career stage and preferred software were associated, χ²(4, N = 180) = 41.50, p < .001, Cramér’s V = .34. In a correspondence analysis of the 3 × 3 table, the first axis explained 93.6% of the total inertia (0.216 of 0.231) and separated doctoral students and R users from faculty and SPSS users; the second axis explained 6.4%. Include the map, label both sets of points, and say which scaling you used. Use the standardized residuals to support any statement about a particular cell.

How to calculate correspondence analysis in Excel, R or Python

Excel

Worksheet formulas cover the table-level quantities. With counts in B2:D4 and totals in row 5 and column E, expected counts are =$E2*B$5/$E$5 and the chi-square contribution of each cell is =(B2-F2)^2/F2. Total chi-square is the sum of those contributions and total inertia is that sum divided by $E$5. Excel has no built-in singular value decomposition function, so use R or Python (or a statistics add-in) for the axes and coordinates.

R

tab = matrix(c(30,20,10, 15,25,20, 5,15,40), nrow = 3, byrow = TRUE,
              dimnames = list(c('Doctoral','Postdoc','Faculty'), c('R','Python','SPSS')))

library(MASS)
fit = corresp(tab, nf = 2)   # fit$cor holds the canonical correlations
biplot(fit)

library(FactoMineR)
res = CA(tab, ncp = 2, graph = FALSE)
res$eig                        # eigenvalue, percentage, cumulative percentage
res$row$coord; res$col$coord   # coordinates

The first value of fit$cor is the first singular value (0.4646 for this table), and the first two eigenvalues from FactoMineR are 0.2158 and 0.0147.

Python

This plain NumPy version reproduces every number above and was run before publication:

import numpy as np
N = np.array([[30, 20, 10],
              [15, 25, 20],
              [5, 15, 40]], dtype=float)
n = N.sum()
P = N / n
r, c = P.sum(axis=1), P.sum(axis=0)           # row and column masses
S = (P - np.outer(r, c)) / np.sqrt(np.outer(r, c))
U, sv, Vt = np.linalg.svd(S)                   # sv = singular values
inertia = sv**2                                # principal inertias
row_coords = (U / np.sqrt(r)[:, None]) * sv    # principal coordinates, rows
col_coords = (Vt.T / np.sqrt(c)[:, None]) * sv # principal coordinates, columns
print(inertia[:2], inertia[:2] / inertia.sum())
print(row_coords[:, :2].round(3))
print(col_coords[:, :2].round(3))

The prince library offers a ready-made class: ca = prince.CA(n_components=2).fit(df), with ca.eigenvalues_summary, ca.row_coordinates(df) and ca.column_coordinates(df) for the outputs (prince documentation).

Sources

  • MASS package, corresp documentation, https://stat.ethz.ch/R-manual/R-devel/library/MASS/html/corresp.html (read 2026-11-14). Cites Venables and Ripley (2002), Modern Applied Statistics with S, 4th ed., Springer.
  • FactoMineR, CA documentation, https://rdrr.io/cran/FactoMineR/man/CA.html (read 2026-11-14). Cites Benzécri (1992), Correspondence Analysis Handbook, Dekker; Greenacre (1993), Correspondence Analysis in Practice, Academic Press; Husson, Lê and Pagès (2010), Exploratory Multivariate Analysis by Example Using R, CRC.
  • prince, CA documentation, https://maxhalford.github.io/prince/ca (read 2026-11-14).
  • Hirschfeld, H. O. (1935), Proceedings of the Cambridge Philosophical Society 31, 520-524; Bourdieu, P. (1984), Distinction, as summarised at https://en.wikipedia.org/wiki/Correspondence_analysis (read 2026-11-14; formulas cross-checked against the book references above).

Data: Correspondence analysis of an illustrative career stage by software table: masses, coordinates and inertia

Principal coordinates on axes 1 and 2, mass, inertia and contribution to axis 1 for each row and column point of a 3 x 3 illustrative contingency table (180 respondents; career stage by most-used analysis software). Computed by the author with a singular value decomposition of the standardized residual matrix following the standard formulas documented in MASS, FactoMineR and Greenacre (1993); the counts are invented for illustration.

Period covered: 2026.

Correspondence analysis of an illustrative career stage by software table: masses, coordinates and inertia
PointSetMassAxis 1 coordinateAxis 2 coordinateInertiaContribution to axis 1 (%)
Doctoral studentsRow0.3333-0.54360.09630.101645.6
PostdocsRow0.3333-0.0478-0.17110.01050.4
FacultyRow0.33330.59140.07470.118554
RColumn0.2778-0.60560.11510.105647.2
PythonColumn0.3333-0.1147-0.16890.01392
SPSSColumn0.38890.53090.06250.111150.8

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about Correspondence Analysis: Contingency Table Maps, Inertia and R/Python

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →