Statistics & probability

Correspondence analysis calculator from a contingency table

Decompose a nonnegative contingency table into chi-square association axes.

Your numbers

2–12 rows and columns; nonnegative counts; every margin positive.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Decompose a nonnegative contingency table into chi-square association axes. Report row and column principal coordinates, inertia fractions and category contributions.

THE FORMULAP=N/n; S=Dᵣ⁻¹ᐟ²(P−rcᵀ)D𝚌⁻¹ᐟ²; S=UΣVᵀ; inertiaₖ=σₖ²; F=Dᵣ⁻¹ᐟ²UΣ; G=D𝚌⁻¹ᐟ²VΣ.

A worked example

The 3×3 table has total inertia 0.408979 and Pearson chi-square 59.301908.

Good to know

2–12 rows and columns; nonnegative finite values, positive row/column totals. Numerical nonzero-axis threshold 1e-12; both sets in principal-coordinate scaling. No inferential chi-square p-value, smoothing, automatic category merging or causal interpretation.

Describe a table through departures from independence

Correspondence analysis summarizes association in a two-way table by comparing observed cell proportions with the proportions expected from independent row and column classifications. It uses chi-square geometry, so the row and column totals affect the distance calculation instead of treating all raw cells as ordinary Euclidean measurements.

The calculator accepts nonnegative counts with positive totals for every row and column. It returns principal coordinates, inertia and contributions for the nonzero axes. These outputs describe the entered table; they are not adjusted causal effects or a prediction model for individual observations.

Chi-square profile coordinates of the example tableR1R2R3C1C2C3Principal coordinates: rows blue, columns green
Scroll across to see the full diagram.
The 3×3 table has total inertia 0.408979 and Pearson chi-square 59.301908.

Compare this with the Principal component analysis calculator from a data matrix. Return chi-square row/column coordinates,inertia and contributions from nonnegative counts rather than Euclidean PCA of measurements.

Start with masses and profiles

A row mass is its total divided by the grand total, and a column mass is defined similarly. Dividing a row by its own total gives a profile across columns. Correspondence analysis compares those profiles while weighting column differences according to their overall prevalence in the table.

A zero row or column has no defined profile and is rejected rather than silently removed. Individual zero cells are allowed because their row and column profiles can still be meaningful. Fractional nonnegative weights are accepted, but inferential interpretations based on independent integer counts need additional justification if the table contains survey or model weights.

Standardize the independence residuals

The central matrix subtracts the outer product of row and column masses from the observed proportions, then divides each residual by the square root of the corresponding mass product. Its singular values determine the principal inertias, and its singular vectors determine the coordinate directions.

Total inertia is the sum of squared standardized residuals. Multiplying it by the grand total gives the ordinary Pearson chi-square statistic for that table. The coordinate construction is descriptive even if no hypothesis test is performed; this page does not calculate a chi-square p-value or certify sparse-cell asymptotic validity.

Read the prefilled three-by-three table

The example places relatively large counts near the main diagonal, so corresponding row and column categories tend to occur together. There are three rows and three columns, allowing at most two nonzero association axes. The first axis captures the largest weighted profile contrast, with the second capturing the remaining orthogonal contrast.

Row and column principal coordinates are both returned, with contributions calculated within each set. If you reverse the sign of an entire axis in a plot, the represented geometry stays the same. Another package may therefore print opposite signs while expressing exactly the same association structure and inertia.

Use contributions to locate influential categories

For a row on a given axis, its contribution is its mass multiplied by its squared principal coordinate, divided by that axis inertia. Column contributions use the corresponding column quantities. Contributions across rows sum to one for each nonzero axis, and the same check applies separately to the columns.

A distant point with very small mass can have a modest contribution, while a less distant common category can drive much of an axis. Consequently, visual distance alone does not identify which categories dominate the decomposition. Contributions help connect the map back to the weighted table that generated it.

Interpret the map with its scaling convention

Distances between row principal coordinates summarize chi-square row-profile distances when all nonzero axes are retained. The analogous statement holds for the column coordinates. Truncating to one or two axes loses some profile geometry, and the inertia fractions quantify the share represented by the retained directions.

Because both sets are principal coordinates, the ordinary Euclidean distance from a row point to a column point is not a direct association measure. Reading every nearby row-column pair as a precise fitted relationship overstates the map. Use the residual table, profiles and chosen biplot convention to support any cross-set interpretation.

Recognize rank and sparse-data limitations

The maximum nonzero rank is the smaller of row count minus one and column count minus one. Exact independence produces no nonzero axes, so an empty coordinate axis list is an informative result rather than a failed optimization. Near-zero directions are omitted using a stated numerical threshold.

Small marginal masses can amplify unusual cells and create unstable-looking maps. The calculator does not merge categories, smooth sparse counts or choose which classifications are scientifically appropriate. Keep the original category labels and marginal totals with any chart so the numerical coordinates remain connected to meaningful table categories.

A few questions, answered

Can some cells be zero?

Yes, provided every row and column has a positive total.

Why can coordinate signs differ across software?

An eigenvector can be multiplied by minus one without changing the geometry.

What does total inertia equal?

It is Pearson chi-square divided by the grand total for the entered table.

Are row-to-column distances directly meaningful?

Not as ordinary distances in this principal/principal scaling; interpret profiles and the chosen biplot convention.

Find your calculator

Start typing to explore the library.