Learn R Programming

car (version 0.8-4)

scatterplot.matrix: Scatterplot Matrices

Description

Scatterplot matrices with univariate displays down the diagonal; spm is an abbreviation for scatterplot.matrix. This function just sets up a call to pairs.

Usage

scatterplot.matrix(x, ...)

scatterplot.matrix.formula(formula, data=NULL, subset, ...)

scatterplot.matrix.default(data, labels=colnames(data), 
diagonal=c("density", "boxplot", "histogram", "qqplot", "none"), 
adjust=1, nclass, plot.points=TRUE, smooth=TRUE, span=0.5, reg.line=lm, 
transform=FALSE, ellipse=FALSE, levels=c(.5, .9), robust=FALSE,
groups=FALSE, by.groups=FALSE, col=palette(), 
pch=1:n.groups, lwd=1, legend.plot=length(levels(groups)) > 1)

spm(x, ...)

Arguments

formula
a one-side ``model'' formula, of the form ~ x1 + x2 + ... + xk or ~ x1 + x2 + ... + xk | z where z evaluates to a factor or other variable to divide the data into groups.
data
data matrix or numeric data frame, or (for scatterplot.matrix.formula) a data frame within which to evaluate the formula.
subset
expression defining a subset of observations.
labels
variable labels (for the diagonal of the plot).
diagonal
contents of the diagonal panels of the plot.
adjust
relative bandwidth for density estimate, passed to density function.
nclass
number of bins for histogram, passed to hist function.
plot.points
if TRUE the points are plotted in each off-diagonal panel.
smooth
if TRUE a lowess smooth is plotted in each off-diagonal panel.
span
span for lowess smoother.
reg.line
if not FALSE a line is plotted using the function given by this argument; e.g., using rlm in package MASS plots a robust-regression line.
transform
if TRUE, multivariate normalizing Box-Cox transformations are computed and plotted; if a vector of powers, one for each variable, these are applied as Box-Cox power transformations prior to plotting.
ellipse
if TRUE data-concentration ellipses are plotted in the off-diagonal panels.
levels
levels or levels at which concentration ellipses are plotted; the default is c(.5, .9).
robust
if TRUE use the cov.trob function in the MASS package to calculate the center and covariance matrix for the data ellipse.
groups
a factor or other variable dividing the data into groups; groups are plotted with different colors and plotting characters.
by.groups
if TRUE, regression lines are fit by groups.
pch
plotting characters for points; default is the plotting characters in order (see par).
col
colors for points and lines; the default is the in the current color palette, starting at the second entry (see palette and par).
lwd
width for lines.
legend.plot
if TRUE then a legend for the groups is plotted in the bottom-right cell.

Value

  • NULL. This function is used for its side effect: producing a plot.

See Also

pairs, scatterplot, data.ellipse, box.cox.powers, box.cox, cov.trob.

Examples

Run this code
data(Duncan)
scatterplot.matrix(~income + education + prestige | type, data=Duncan)
scatterplot.matrix(~income + education + prestige, 
    transform=T, data=Duncan)

Run the code above in your browser using DataLab