Find the principal canonical correlation and corresponding row- and column-scores from a correspondence analysis of a two-way contingency table.
# S3 method for matrix corresp(x, nf = 1, …)
# S3 method for factor corresp(x, y, …)
# S3 method for data.frame corresp(x, …)
# S3 method for xtabs corresp(x, …)
# S3 method for formula corresp(formula, data, …)
- x, formula
The function is generic, accepting various forms of the principal
argument for specifying a two-way frequency table. Currently accepted
forms are matrices, data frames (coerced to frequency tables), objects
"xtabs"and formulae of the form
~ F1 + F2, where
- The number of factors to be computed. Note that although 1 is the most usual, one school of thought takes the first two singular vectors for a sort of biplot.
- a second factor for a cross-classification.
- a data frame against which to preferentially resolve variables in the formula.
- If the principal argument is a formula, a data frame may be specified as well from which variables in the formula are preferentially satisfied.
See Venables & Ripley (2002). The
plot method produces a graphical
representation of the table if
nf=1, with the areas of circles
representing the numbers of points. If
nf is two or more the
biplot method is called, which plots the second and third columns of
A = Dr^(-1/2) U L and
B = Dc^(-1/2) V L where the
singular value decomposition is
U L V. Thus the x-axis is the
canonical correlation times the row and column scores. Although this
is called a biplot, it does not have any useful inner product
relationship between the row and column scores. Think of this as an
equally-scaled plot with two unrelated sets of labels. The origin is
marked on the plot with a cross. (For other versions of this plot see
An list object of class
"correspondence" for which
biplot methods are supplied.
The main components are the canonical correlation(s) and the row
and column scores.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer. Gower, J. C. and Hand, D. J. (1996) Biplots. Chapman & Hall.
(ct <- corresp(~ Age + Eth, data = quine)) plot(ct) corresp(caith) biplot(corresp(caith, nf = 2))