Correspondence analysis (CA) is a multivariate statistical technique proposed[1] by Herman Otto Hartley (Hirschfeld)[2] and later developed by Jean-Paul Benzécri.[3] It is conceptually similar to principal component analysis, but applies to categorical rather than continuous data. In a similar manner to principal component analysis, it provides a means of displaying or summarising a set of data in two-dimensional graphical form. Its aim is to display in a biplot any structure hidden in the multivariate setting of the data table. As such it is a technique from the field of multivariate ordination. Since the variant of CA described here can be applied either with a focus on the rows or on the columns it should in fact be called simple (symmetric) correspondence analysis.[4]
It is traditionally applied to the contingency table of a pair of nominal variables where each cell contains either a count or a zero value. If more than two categorical variables are to be summarized, a variant called multiple correspondence analysis should be chosen instead. CA may also be applied to binary data given the presence/absence coding represents simplified count data i.e. a 1 describes a positive count and 0 stands for a count of zero. Depending on the scores used CA preserves the chi-square distance[5] [6] between either the rows or the columns of the table. Because CA is a descriptive technique, it can be applied to tables regardless of a significant chi-squared test.[7] [8] Although the statistic used in inferential statistics and the chi-square distance are computationally related they should not be confused since the latter works as a multivariate statistical distance measure in CA while the statistic is in fact a scalar not a metric.[9]
Like principal components analysis, correspondence analysis creates orthogonal components (or axes) and, for each item in a table i.e. for each row, a set of scores (sometimes called factor scores, see Factor analysis). Correspondence analysis is performed on the data table, conceived as matrix C of size m × n where m is the number of rows and n is the number of columns. In the following mathematical description of the method capital letters in italics refer to a matrix while letters in italics refer to vectors. Understanding the following computations requires knowledge of matrix algebra.
Before proceeding to the central computational step of the algorithm, the values in matrix C have to be transformed.[10] First compute a set of weights for the columns and the rows (sometimes called masses),[7] [11] where row and column weights are given by the row and column vectors, respectively:
wm=
1 | |
nC |
C1, wn=
1 | |
nC |
1TC.
nC=
n | |
\sum | |
i=1 |
m | |
\sum | |
j=1 |
Cij
1
Put in simple words,
wm
wn
The weights are transformed into diagonal matrices
Wm=\operatorname{diag}(1/\sqrt{wm})
and
Wn=\operatorname{diag}(1/\sqrt{wn})
where the diagonal elements of
Wn
1/\sqrt{wn}
Wm
1/\sqrt{wm}
Next, compute matrix
P
C
P=
1 | |
nC |
C.
In simple words, Matrix
P
Finally, compute matrix
S
S=Wm(P-wmwn)Wn
wm
wn
P
\operatorname{outer}(wm,wn)
P
Wm
Wn
Wm
Wn
The vectors
wm
wn
\operatorname{outer}(wm,wn)
P
\operatorname{outer}(wm,wn)
In fact matrix
\operatorname{outer}(wm,wn)
S
The table
S
S=U\SigmaV*
where
U
V
S
\Sigma
\sigmai
S
\Sigma
p\leq(min(m,n)-1)
U
V
U
V
U*U=V*V=I
In other words, the multivariate information that is contained in
C
S
U
V
\Sigma
While a principal component analysis may be said to decompose the (co)variance, and hence its measure of success is the amount of (co-)variance covered by the first few PCA axes - measured in eigenvalue -, a CA works with a weighted (co-)variance which is called inertia.[13] The sum of the squared singular values is the total inertia
\Iota
\Iota=
p | |
\sum | |
i=1 |
2. | |
\sigma | |
i |
\Iota
S
\Iota=
n | |
\sum | |
i=1 |
m | |
\sum | |
j=1 |
2. | |
s | |
ij |
\iotai
\epsiloni
\epsiloni=
2 | |
\sigma | |
i |
/
p | |
\sum | |
i=1 |
2 | |
\sigma | |
i |
\epsiloni
To transform the singular vectors to coordinates which preserve the chisquare distances between rows or columns an additional weighting step is necessary. The resulting coordinates are called principal coordinates in CA text books. If principal coordinates are used for rows their visualization is called a row isometric[14] scaling in econometrics and scaling 1[15] in ecology. Since the weighting includes the singular values
\Sigma
S
SS*
U
S
S*S
V
S
\Sigma
Factor scores or principal coordinates for the rows of matrix C are computed by
Fm=WmU\Sigma
i.e. the left singular vectors are scaled by the inverse of the square roots of the row masses and by the singular values. Because principal coordinates are computed using singular values they contain the information about the spread between the rows (or columns) in the original table. Computing the euclidean distances between the entities in principal coordinates results in values that equal their chisquare distances which is the reason why CA is said to "preserve chisquare distances".
Compute principal coordinates for the columns by
Fn=WnV\Sigma.
To represent the result of CA in a proper biplot, those categories which are not plotted in principal coordinates, i.e. in chisquare distance preserving coordinates, should be plotted in so called standard coordinates. They are called standard coordinates because each vector of standard coordinates has been standardized to exhibit mean 0 and variance 1.[16] When computing standard coordinates the singular values are omitted which is a direct result of applying the biplot rule by which one of the two sets of singular vector matrices must be scaled by singular values raised to the power of zero i.e. multiplied by one i.e. be computed by omitting the singular values if the other set of singular vectors have been scaled by the singular values. This reassures the existence of a inner product between the two sets of coordinates i.e. it leads to meaningful interpretations of their spatial relations in a biplot.
In practical terms one can think of the standard coordinates as the vertices of the vector space in which the set of principal coordinates (i.e. the respective points) "exists".[17] The standard coordinates for the rows are
Gm=WmU
and those for the columns are
Gn=WnV
Note that a scaling 1 biplot in ecology implies the rows to be in principal and the columns to be in standard coordinates while scaling 2 implies the rows to be in standard and the columns to be in principal coordinates. I.e. scaling 1 implies a biplot of
Fm
Gn
Fn
Gm
The visualization of a CA result always starts with displaying the scree plot of the principal inertia values to evaluate the success of summarizing spread by the first few singular vectors.
The actual ordination is presented in a graph which could - at first look - be confused with a complicated scatter plot. In fact it consists of two scatter plots printed one upon the other, one set of points for the rows and one for the columns. But being a biplot a clear interpretation rule relates the two coordinate matrices used.
Usually the first two dimensions of the CA solution are plotted because they encompass the maximum of information about the data table that can be displayed in 2D although other combinations of dimensions may be investigated by a biplot. A biplot is in fact a low dimensional mapping of a part of the information contained in the original table.
As a rule of thumb that set (rows or columns) which should be analysed with respect to its composition as measured by the other set is displayed in principal coordinates while the other set is displayed in standard coordinates. E.g. a table displaying voting districts in rows and political parties in columns with the cells containing the counted votes may be displayed with the districts (rows) in principal coordinates when the focus is on ordering districts according to similar voting.
Traditionally, originating from the french tradition in CA,[18] early CA biplots mapped both entities in the same coordinate version, usually principal coordinates, but this kind of display is misleading insofar as: "Although this is called a biplot, it does not have any useful inner product relationship between the row and column scores" as Brian Ripley, maintainer of R package MASS points out correctly.[19] Today that kind of display should be avoided since laymen usually are not aware of the lacking relation between the two point sets.
A scaling 1 biplot (rows in principal coordinates, columns in standard coordinates) is interpreted as follows:[20]
Several variants of CA are available, including detrended correspondence analysis (DCA) and canonical correspondence analysis (CCA). The latter (CCA) is used when there is information about possible causes for the similarities between the investigated entities. The extension of correspondence analysis to many categorical variables is called multiple correspondence analysis. An adaptation of correspondence analysis to the problem of discrimination based upon qualitative variables (i.e., the equivalent of discriminant analysis for qualitative data) is called discriminant correspondence analysis or barycentric discriminant analysis.
In the social sciences, correspondence analysis, and particularly its extension multiple correspondence analysis, was made known outside France through French sociologist Pierre Bourdieu's application of it.[21]
ade4::dudi.coa
, ca::ca
, ExPosition::epCA
, FactoMineR::CA
, MASS::corresp
, vegan::cca
. The easiest approach for beginners is ca::ca
as there is an extensive text book[22] accompanying that package.