Learn R Programming

heplots (version 0.8-1)

heplot3d: Three-Dimensional HE Plots

Description

This function plots ellipsoids in 3D representing the hypothesis and error sums-of-squares-and-products matrices for terms aand linear hypotheses in a multivariate linear model.

Usage

heplot3d(mod, ...)

## S3 method for class 'mlm':
heplot3d(mod, terms, hypotheses, term.labels = TRUE, 
    hyp.labels = TRUE, variables = 1:3, error.ellipsoid = !add,
    factor.means = !add, grand.mean = !add, remove.intercept = TRUE, 
    type = c("II", "III", "2", "3"), manova, size = c("evidence", "effect.size"),
    level = 0.68, alpha = 0.05,  segments = 40, col = palette()[-1], lwd=c(1, 4),
    bg.col = c("white", "black"), fogtype = c("none", "exp2", "linear", "exp"), 
    fov = 30, offset = 0.01, xlab, ylab, zlab, add = FALSE, verbose = FALSE, 
    warn.rank = FALSE, ...)

Arguments

mod
a model object of class "mlm".
terms
a logical value or character vector of terms in the model for which to plot hypothesis matrices; if missing or TRUE, defaults to all terms; if FALSE, no terms are plotted.
hypotheses
optional list of linear hypotheses for which to plot hypothesis matrices; hypotheses are specified as for the linear.hypothesis function in the car package; the list
term.labels
logical value or character vector of names for the terms to be plotted. If TRUE (the default) the names of the terms are used; if FALSE, term labels are not plotted.
hyp.labels
logical value or character vector of names for the hypotheses to be plotted. If TRUE (the default) the names of components of the list of hypotheses are used; if FALSE, hypothesis labels are not plotted.
variables
indices or names of the two response variables to be plotted; defaults to 1:3.
error.ellipsoid
if TRUE, plot the error ellipsoid; defaults to TRUE, if the argument add is FALSE (see below).
factor.means
logical value or character vector of names of factors for which the means are to be plotted, or TRUE or FALSE; defaults to TRUE, if the argument add is FALSE (see below).
grand.mean
if TRUE, plot the centroid for all of the data; defaults to TRUE, if the argument add is FALSE (see below).
remove.intercept
if TRUE (the default), do not plot the ellipsoid for the intercept even if it is in the MANOVA table.
type
``type'' of sum-of-squares-and-products matrices to compute; one of "II", "III", "2", or "3", where "II" is the default (and "2" is a synomym).
manova
optional Anova.mlm object for the model; if absent a MANOVA is computed. Specifying the argument can therefore save computation in repeated calls.
size
how to scale the hypothesis ellipsoid relative to the error ellipsoid; if "evidence", the default, the scaling is done so that a ``significant'' hypothesis elliposid extends outside of the error ellipsoid; if "effect.size
level
equivalent coverage of ellipsoid for normally-distributed errors, defaults to 0.68.
alpha
signficance level for Roy's greatest-root test statistic; if size="evidence", then the hypothesis ellipsoid is scaled so that it just touches the error ellipsoid at the specified alpha level; a larger hypothesis elllipsoid ther
segments
number of segments composing each elliposid; defaults to 40.
col
a colour or vector of colours to use in plotting ellipsoids; the first colour is used for the error ellipsoid; the remaining colours --- recycled as necessary --- are used for the hypothesis ellipsoids; a single colour can be given, in whi
lwd
a two-element vector giving the line width for drawing ellipsoids (including those that degenerate to an ellipse) and for drawing ellipsoids that degenerate to a line segment. The default is c(1, 4).
bg.col
background colour, "white" or "black", defaulting to "white".
fogtype
type of ``fog'' to use for depth-cueing; the default is "none". See bg.
fov
field of view angle; controls perspective. See viewpoint.
offset
proportion of axes to off set labels; defaults to 0.01.
xlab
x-axis label; defaults to name of the x variable.
ylab
y-axis label; defaults to name of the y variable.
zlab
z-axis label; defaults to name of the z variable.
add
if TRUE, add to the current plot; the default is FALSE. If TRUE, the error ellipsoid is not plotted
verbose
if TRUE, print the MANOVA table and details of hypothesis tests; the default is FALSE.
warn.rank
if TRUE, do not suppress warnings about the rank of the hypothesis matrix when the ellipsoid collapses to an ellipse or line; the default is FALSE.
...
arguments passed from generic.

Value

  • heplot3d returns nothing useful --- it is used for the side effect of drawing or adding to an rgl graph. The function leaves an object named .frame in the global environment, containing the rgl object IDs for the axes, axis labels, and bounding box; these are deleted and the axes, etc. redrawn if the plot is added to.

Details

When the H matrix for a term has rank < 3, the ellipsoid collapses to an ellipse (rank(H)=2) or a line (rank(H)=1).

References

Friendly, M. (2006). Data Ellipses, HE Plots and Reduced-Rank Displays for Multivariate Linear Models: SAS Software and Examples Journal of Statistical Software, 17(6), 1-42. http://www.jstatsoft.org/v17/i06/ Friendly, M. (2007). HE plots for Multivariate General Linear Models. Journal of Computational and Graphical Statistics, 16, in press. http://www.math.yorku.ca/SCS/Papers/heplots.pdf

See Also

Anova, linear.hypothesis, heplot, pairs.mlm, rgl.

Examples

Run this code
# Soils data, from car package
soils.mod <- lm(cbind(pH,N,Dens,P,Ca,Mg,K,Na,Conduc) ~ Block + Contour*Depth, data=Soils)
Anova(soils.mod)

heplot(soils.mod, variables=c("Ca", "Mg"))
pairs(soils.mod, terms="Depth", variables=c("pH", "N", "P", "Ca", "Mg"))

heplot3d(soils.mod, variables=c("Mg", "Ca", "Na"))

Run the code above in your browser using DataLab