Description Usage Arguments Details Value Author(s) References See Also Examples
These functions plot ellipses (or ellipsoids in 3D) in canonical discriminant space representing the hypothesis and error sums-of-squares-and-products matrices for terms in a multivariate linear model. They provide a low-rank 2D (or 3D) view of the effects for that term in the space of maximum discrimination.
1 2 3 4 5 6 7 8 9 10 11 | ## S3 method for class 'candisc'
heplot(mod, which = 1:2, scale, asp = 1, var.col = "blue",
var.lwd = par("lwd"), var.cex=par("cex"), var.pos,
rev.axes=c(FALSE, FALSE),
prefix = "Can", suffix = TRUE, terms = mod$term, ...)
## S3 method for class 'candisc'
heplot3d(mod, which = 1:3, scale, asp="iso", var.col = "blue",
var.lwd=par("lwd"), var.cex=rgl::par3d("cex"),
prefix = "Can", suffix = FALSE, terms = mod$term,
...)
|
mod |
A |
which |
A numeric vector containing the indices of the canonical dimensions to plot. |
scale |
Scale factor for the variable vectors in canonical space. If not specified, the function calculates one to make the variable vectors approximately fill the plot window. |
asp |
Aspect ratio for the horizontal and vertical
dimensions. The defaults, |
var.col |
Color for variable vectors and labels |
var.lwd |
Line width for variable vectors |
var.cex |
Text size for variable vector labels |
var.pos |
Position(s) of variable vector labels wrt. the end point. If not specified, the labels are out-justified left and right with respect to the end points. |
rev.axes |
Logical, a vector of |
prefix |
Prefix for labels of canonical dimensions. |
suffix |
Suffix for labels of canonical dimensions. If |
terms |
Terms from the original |
... |
Arguments to be passed down to |
The generalized canonical discriminant analysis for one term in a mlm
is based on the eigenvalues, lambda_i, and eigenvectors, V,
of the H and E matrices for that term. This produces uncorrelated
canonical scores which give the maximum univariate F statistics.
The canonical HE plot is then just the HE plot of the canonical scores
for the given term.
For heplot3d.candisc
, the default asp="iso"
now gives a geometrically
correct plot, but the third dimension, CAN3, is often small. Passing an expanded
range in zlim
to heplot3d
usually helps.
heplot.candisc
returns invisibly an object of class "heplot"
, with
coordinates for the various hypothesis ellipses and the error ellipse, and
the limits of the horizontal and vertical axes.
Similarly, heploted.candisc
returns an object of class "heplot3d"
.
Michael Friendly and John Fox
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(2) 421–444. http://datavis.ca/papers/jcgs-heplots.pdf
candisc
, candiscList
,
heplot
, heplot3d
, aspect3d
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | grass.mod <- lm(cbind(N1,N9,N27,N81,N243) ~ Block + Species, data=Grass)
grass.can1 <-candisc(grass.mod, term="Species")
grass.canL <-candiscList(grass.mod)
heplot(grass.can1, scale=6)
heplot(grass.can1, scale=6, terms=TRUE)
heplot(grass.canL, terms=TRUE, ask=FALSE)
## Not run:
heplot3d(grass.can1, wire=FALSE)
# compare with non-iso scaling
rgl::aspect3d(x=1,y=1,z=1)
# or,
# heplot3d(grass.can1, asp=NULL)
## End(Not run)
## Pottery data, from car package
pottery.mod <- lm(cbind(Al, Fe, Mg, Ca, Na) ~ Site, data=Pottery)
pottery.can <-candisc(pottery.mod)
heplot(pottery.can, var.lwd=3)
heplot3d(pottery.can, var.lwd=3, scale=10, zlim=c(-3,3), wire=FALSE)
## Not run:
play3d(rgl::spin3d(axis = c(1, 0, 0), rpm = 5), duration=12)
## End(Not run)
## FootHead data, from heplots package
## Not run:
library(heplots)
data(FootHead)
# use Helmert contrasts for group
contrasts(FootHead$group) <- contr.helmert
foot.mod <- lm(cbind(width, circum,front.back,eye.top,ear.top,jaw)~group, data=FootHead)
foot.can <- candisc(foot.mod)
heplot(foot.can, main="Candisc HE plot",
hypotheses=list("group.1"="group1","group.2"="group2"),
col=c("red", "blue", "green3", "green3" ), var.col="red")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.