showEig: Show the eigenvectors associated with a covariance matrix

View source: R/showEig.R

showEigR Documentation

Show the eigenvectors associated with a covariance matrix

Description

This function is designed for illustrating the eigenvectors associated with the covariance matrix for a given bivariate data set. It draws a data ellipse of the data and adds vectors showing the eigenvectors of the covariance matrix.

Usage

showEig(
  X,
  col.vec = "blue",
  lwd.vec = 3,
  mult = sqrt(qchisq(levels, 2)),
  asp = 1,
  levels = c(0.5, 0.95),
  plot.points = TRUE,
  add = !plot.points,
  ...
)

Arguments

X

A two-column matrix or data frame

col.vec

color for eigenvectors

lwd.vec

line width for eigenvectors

mult

length multiplier(s) for eigenvectors

asp

aspect ratio of plot, set to asp=1 by default, and passed to dataEllipse

levels

passed to dataEllipse determining the coverage of the data ellipse(s)

plot.points

logical; should the points be plotted?

add

logical; should this call add to an existing plot?

...

other arguments passed to link[car]{dataEllipse}

Author(s)

Michael Friendly

See Also

dataEllipse

Examples

x <- rnorm(200)
y <- .5 * x + .5 * rnorm(200)
X <- cbind(x,y)
showEig(X)

# Duncan data
data(Duncan, package="carData")
showEig(Duncan[, 2:3], levels=0.68)
showEig(Duncan[,2:3], levels=0.68, robust=TRUE, add=TRUE, fill=TRUE)

matlib documentation built on Dec. 9, 2022, 1:09 a.m.