Learn R Programming

ca (version 0.71.1)

plot.mjca: Plotting 2D maps in multiple and joint correspondence analysis

Description

Graphical display of multiple and joint correspondence analysis results in two dimensions

Usage

# S3 method for mjca
plot(x, dim = c(1,2), map = "symmetric", centroids = FALSE, 
     what = c("none", "all"), mass = c(FALSE, FALSE), 
     contrib = c("none", "none"), col = c("#000000", "#FF0000"), 
     pch = c(16, 1, 17, 24), 
     labels = c(2, 2), collabels = c("both", "level", "factor"),
     arrows = c(FALSE, FALSE), xlab = "_auto_", ylab = "_auto_", ...)

Arguments

x

Multiple or joint correspondence analysis object returned by mjca

dim

Numerical vector of length 2 indicating the dimensions to plot on horizontal and vertical axes respectively; default is first dimension horizontal and second dimension vertical.

map

Character string specifying the map type. Allowed options include "symmetric" (default) "rowprincipal" "colprincipal" "symbiplot" "rowgab" "colgab" "rowgreen" "colgreen"

centroids

Logical indicating if column centroids should be added to the plot

what

Vector of two character strings specifying the contents of the plot. First entry sets the rows and the second entry the columns. Allowed values are "all" (all available points, default) "active" (only active points are displayed) "passive" (only supplementary points are displayed) "none" (no points are displayed) The status (active or supplementary) of columns is set in mjca using the option supcol.

mass

Vector of two logicals specifying if the mass should be represented by the area of the point symbols (first entry for rows, second one for columns)

contrib

Vector of two character strings specifying if contributions (relative or absolute) should be represented by different colour intensities. Available options are "none" (contributions are not indicated in the plot). "absolute" (absolute contributions are indicated by colour intensities). "relative" (relative contributions are indicated by colour intensities). If set to "absolute" or "relative", points with zero contribution are displayed in white. The higher the contribution of a point, the closer the corresponding colour to the one specified by the col option.

col

Vector of length 2 specifying the colours of row and column point symbols, by default black for rows and red for columns. Colours can be entered in hexadecimal (e.g. "#FF0000"), rgb (e.g. rgb(1,0,0)) values or by R-name (e.g. "red").

pch

Vector of length 4 giving the type of points to be used for row active and supplementary, column active and supplementary points. See pchlist for a list of symbols.

labels

Vector of length two specifying if the plot should contain symbols only (0), labels only (1) or both symbols and labels (2). Setting labels to 2 results in the symbols being plotted at the coordinates and the labels with an offset.

collabels

Determines the format used for column labels, when the columns are labeled in the plot. "both" uses the factor names and level value, in the form "factor:level" "level" uses the factor level value only "factor" uses the factor name only

arrows

Vector of two logicals specifying if the plot should contain points (FALSE, default) or arrows (TRUE). First value sets the rows and the second value sets the columns.

xlab, ylab

Labels for horizontal and vertical axes. The default, "_auto_" means that the function auto-generates a label of the form Dimension X (xx.xx %)

...

Further arguments passed to plot and points.

Value

In addition to the side effect of producing the plot, the function invisibly returns the coordinates of the plotted points, a list of two components, with names rows and cols. These can be used to further annotate the plot using base R plotting functions.

Details

The function plot.mjca makes a two-dimensional map of the object created by mjca with respect to two selected dimensions. By default the scaling option of the map is "symmetric", that is the so-called symmetric map. In this map both the row and column points are scaled to have inertias (weighted variances) equal to the principal inertia (eigenvalue) along the principal axes, that is both rows and columns are in pricipal coordinates. Other options are as follows:

  • -"rowprincipal" or "colprincipal" - these are the so-called asymmetric maps, with either rows in principal coordinates and columns in standard coordinates, or vice versa (also known as row-metric-preserving or column-metric-preserving respectively). These maps are biplots;

  • -"symbiplot" - this scales both rows and columns to have variances equal to the singular values (square roots of eigenvalues), which gives a symmetric biplot but does not preserve row or column metrics;

  • -"rowgab" or "colgab" - these are asymmetric maps (see above) with rows (respectively, columns) in principal coordinates and columns (respectively, rows) in standard coordinates multiplied by the mass of the corresponding point. These are also biplots and were proposed by Gabriel & Odoroff (1990);

  • -"rowgreen" or "colgreen" - these are similar to "rowgab" and "colgab" except that the points in standard coordinates are multiplied by the square root of the corresponding masses, giving reconstructions of the standardized residuals.

This function has options for sizing and shading the points. If the option mass is TRUE for a set of points, the size of the point symbol is proportional to the relative frequency (mass) of each point. If the option contrib is "absolute" or "relative" for a set of points, the colour intensity of the point symbol is proportional to the absolute contribution of the points to the planar display or, respectively, the quality of representation of the points in the display. To globally resize all the points (and text labels), use par("cex"=) before the plot.

References

Gabriel, K.R. and Odoroff, C. (1990). Biplots in biomedical research. Statistics in Medicine, 9, pp. 469-485. Greenacre, M.J. (1993) Correspondence Analysis in Practice. London: Academic Press. Greenacre, M.J. (1993) Biplots in correspondence Analysis, Journal of Applied Statistics, 20, pp. 251 - 269.

See Also

mjca, summary.mjca, print.mjca, pchlist

Examples

Run this code
# NOT RUN {
data("wg93")

# A two-dimensional map with standard settings
plot(mjca(wg93[,1:4]))

# }

Run the code above in your browser using DataLab