Last data update: 2014.03.03

R: Scatterplot Matrices
scatterplotMatrixBCAR Documentation

Scatterplot Matrices

Description

A minor modification of the car package's scatterplotMatrix function that makes enhanced scatterplot matrices with univariate displays down the diagonal; spmBCA is an abbreviation for scatterplotMatrixBCA. This function just sets up a call to pairs with custom panel functions.

Usage


scatterplotMatrixBCA(x, ...)

## S3 method for class 'formula'
scatterplotMatrixBCA(x, data=NULL, subset, labels, ...)

## Default S3 method:
scatterplotMatrixBCA(x, var.labels = colnames(x), diagonal = c("density",
                 "boxplot", "histogram", "oned", "qqplot", "none"),
                 adjust = 1, nclass, plot.points = TRUE, smooth = TRUE,
                 spread = smooth && !by.groups, span = 0.5,
                 loess.threshold = 2, reg.line = lm, transform = FALSE,
                 family = c("bcPower", "yjPower"), ellipse = FALSE,
                 levels = c(0.5, 0.95), robust = TRUE, groups = NULL,
                 by.groups = FALSE, labels, id.method = "mahal", id.n =
                 0, id.cex = 1, id.col = palette()[1], col = if
                 (n.groups == 1) palette()[c(2, 1, 3)] else rep(palette(),
                 length = n.groups), pch = 1:n.groups, lwd = 2,
                 lwd.smooth = lwd, lwd.spread = lwd, lty = 1,
                 lty.smooth = lty, lty.spread = 2, cex = par("cex"),
                 cex.axis = par("cex.axis"), cex.labels = NULL,
                 cex.main = par("cex.main"), legend.plot =
                 length(levels(groups)) > 1, row1attop = TRUE, ...)


spmBCA(x, ...)

Arguments

x

a data matrix, numeric data frame, or a one-sided “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

for scatterplotMatrix.formula, a data frame within which to evaluate the formula.

subset

expression defining a subset of observations.

labels,id.method,id.n,id.cex,id.col

Arguments for the labelling of points. The default is id.n=0 for labeling no points. See showLabels for details of these arguments. If the plot uses different colors for groups, then the id.col argument is ignored and label colors are determined by the col argument.

var.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 loess smooth is plotted in each off-diagonal panel.

spread

if TRUE (the default when not smoothing by groups), a smoother is applied to the root-mean-square positive and negative residuals from the loess line to display conditional spread and asymmetry.

span

span for loess smoother.

loess.threshold

suppress the loess smoother if there are fewer than loess.threshold unique values (default, 5) of the variable on the vertical axis.

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 power transformations are computed with powerTransform, rounding the estimated powers to ‘nice’ values for plotting; if a vector of powers, one for each variable, these are applied prior to plotting. If there are groups and by.groups is TRUE, then the transformations are estimated conditional on the groups factor.

family

family of transformations to estimate: "bcPower" for the Box-Cox family or "yjPower" for the Yeo-Johnson family (see powerTransform).

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 ellipses.

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 lines and points; the default is taken from the color palette, with palette()[2] for nonparametric regression lines and palette()[1] for linear regression lines and points if there are no groups, and successive colors for the groups if there are groups.

lwd

width of linear-regression lines (default 1).

lwd.smooth

width for smooth regression lines (default is the same as lwd).

lwd.spread

width for lines showing spread (default is the same as lwd).

lty

type of linear-regression lines (default 1, solid line).

lty.smooth

type of smooth regression lines (default is the same as lty).

lty.spread

width for lines showing spread (default is 2, broken line).

cex, cex.axis, cex.labels, cex.main

set sizes of various graphical elements (see par).

legend.plot

if TRUE then a legend for the groups is plotted in the first diagonal cell.

row1attop

If TRUE (the default) the first row is at the top, as in a matrix, as opposed to at the bottom, as in graph (argument suggested by Richard Heiberger).

...

arguments to pass down.

Value

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

Author(s)

John Fox with minor modifications by Dan Putler

See Also

scatterplotMatrix

Results