Learn R Programming

vcd (version 0.1-3.5)

mosaicpairs: Mosaic Matrices

Description

Plots matrices of mosaics.

Usage

## S3 method for class 'default':
mosaicpairs(x, main = deparse(substitute(x)),
            xlab = NULL, ylab = NULL, labels, ...,
            type = c("pairwise", "total", "conditional", "joint"),
            shade = TRUE, oma = NULL, cex.labels = NULL, label.pos = 0.5,
	    font.labels = 1, gap = 1)
## S3 method for class 'formula':
mosaicpairs(formula, data = NULL, \dots, main, subset)

Arguments

x
a contingency table in array form, with optional category labels specified in the dimnames(x) attribute. The table is best created by the table() command.
main
character string for the mosaic title.
xlab,ylab
x- and y-axis labels used for the plot; by default, the first and second element of names(dimnames(X)) (i.e., the name of the first and second variable in X).
labels
the names of the variables.
...
further parameters (currently not used).
type
a character string indicating the type of mosaic matrix, see details for more information.
shade
a logical indicating whether to produce extended mosaic plots, or a numeric vector of at most 5 distinct positive numbers giving the absolute values of the cut points for the residuals. By default, shade is TRUE. Us
oma
A vector of the form c(bottom, left, top, right) giving the size of the outer margins in lines of text.
cex.labels, font.labels
graphics parameters for the text panel.
label.pos
y position of labels in the text panel.
gap
distance between subplots, in margin lines.
formula
a formula, such as y ~ x.
data
a data.frame (or list), or a contingency table from which the variables in formula should be taken.
subset
an optional vector specifying a subset of observations to be used for plotting.

Details

mosaicpairs() plots a matrix of pairwise mosaic plots, four independence types are distinguished: "pairwise", "total", "conditional" and "joint". The pairwise mosaic matrix shows bivariate marginal relations, collapsed over all other variables. The total independence mosaic matrix shows mosaic plots for mutual independence, i.e. for marginal and conditional independence among all pairs of variables. The conditional independence mosaic matrix shows mosaic plots for marginal independence given all other variables. The joint independence mosaic matrix shows mosaic plots for joint independence of all pairs of variables from the others.

References

M. Friendly (2000), Visualizing Categorical Data. SAS Institute, Cary, NC.

See Also

mosaicplot, pairs.

Examples

Run this code
data(UCBAdmissions)
data(PreSex)

mosaicpairs(PreSex, shade = TRUE)
mosaicpairs(UCBAdmissions, shade = TRUE)
mosaicpairs(UCBAdmissions, shade = TRUE, type="conditional")

Run the code above in your browser using DataLab