corres.fnc {languageR} | R Documentation |
Correspondence Analysis
Description
Correspondence analysis for a contingency table.
Usage
corres.fnc(xtab)
Arguments
xtab |
A data frame cross-tabulating frequencies. |
Value
A correspondence object with summary and plot methods.
The summary method lists eigenvalue rates and coordinates, correlations
and contributions for Factor 1 and Factor 2. By default, only the
first six rows of the factor tables are shown. Full tables are
obtained by specifying header = FALSE
when calling summary
.
For information on higher dimensions, set the option n
to the
desired number (e.g., n = 3
) within summary
.
See plot.corres
for documentation of plot options.
Author(s)
Extension of the code in Murtagh (2005) by R. Harald Baayen
Radboud University Nijmegen & Max Planck Institute for Psycholinguistics
Nijmegen, The Netherlands
email: baayen@mpi.nl
References
F. Murtagh (2005) Correspondence Analysis and Data Coding with JAVA and R, Chapman & Hall/CRC, Boca Raton, FL.
See Also
See corsup.fnc
for adding supplementary data to a
correspondence plot, and plot.corres
for plot options.
Examples
## Not run:
data(oldFrench)
oldFrench.ca = corres.fnc(oldFrench)
oldFrench.ca
summary(oldFrench.ca, head = TRUE)
plot(oldFrench.ca)
# more readable plot
data(oldFrenchMeta)
plot(oldFrench.ca, rlabels = oldFrenchMeta$Genre,
rcol = as.numeric(oldFrenchMeta$Genre), rcex = 0.5,
extreme = 0.1, ccol = "blue")
# create subset of proze texts
prose = oldFrench[oldFrenchMeta$Genre=="prose" &
!is.na(oldFrenchMeta$Year),]
proseinfo = oldFrenchMeta[oldFrenchMeta$Genre=="prose" &
!is.na(oldFrenchMeta$Year),]
proseinfo$Period = as.factor(proseinfo$Year <= 1250)
prose.ca = corres.fnc(prose)
plot(prose.ca, addcol = FALSE,
rcol = as.numeric(proseinfo$Period) + 1,
rlabels = proseinfo$Year, rcex = 0.7)
# and add supplementary data for texts with unknown date of composition
proseSup = oldFrench[oldFrenchMeta$Genre == "prose" &
is.na(oldFrenchMeta$Year),]
corsup.fnc(prose.ca, bycol = FALSE, supp = proseSup, font = 2,
cex = 0.8, labels = substr(rownames(proseSup), 1, 4))
## End(Not run)