wrap_hull()
computes convex hull of a set of observations.wrap_confidence()
computes a confidence ellipse.wrap_tolerance()
computes a tolerance ellipse.
Usage
wrap_hull(x, ...)
wrap_confidence(x, ...)
wrap_tolerance(x, ...)
# S4 method for MultivariateAnalysis
wrap_confidence(x, margin = 1, axes = c(1, 2), group = NULL, level = 0.95)
# S4 method for MultivariateAnalysis
wrap_tolerance(x, margin = 1, axes = c(1, 2), group = NULL, level = 0.95)
# S4 method for MultivariateAnalysis
wrap_hull(x, margin = 1, axes = c(1, 2), group = NULL)
Arguments
- x
An object from which to wrap observations (a
CA
orPCA
object).- ...
Currently not used.
- margin
A length-one
numeric
vector giving the subscript which the data will be returned:1
indicates individuals/rows (the default),2
indicates variables/columns.- axes
A length-two
numeric
vector giving the dimensions to be for which to compute results.- group
A vector specifying the group an observation belongs to.
- level
A
numeric
vector specifying the confidence/tolerance level.
Value
wrap_*()
returns a data.frame
of envelope x
and y
coordinates.
An extra column named group
is added specifying the group an observation
belongs to.
See also
Other plot methods:
biplot()
,
screeplot()
,
viz_contributions()
,
viz_individuals()
,
viz_variables()
,
viz_wrap
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE)
#> 1 qualitative variable was removed: Species.
## Convex hull coordinates
hulls <- wrap_hull(X, margin = 1, group = iris$Species)
## Confidence ellipse coordinates
conf <- wrap_confidence(X, margin = 1, group = iris$Species,
level = c(0.68, 0.95))
## Tolerance ellipse coordinates
conf <- wrap_confidence(X, margin = 1, group = iris$Species, level = 0.95)
## Plot with convex hulls
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, highlight = iris$Species, col = col)
viz_hull(X, group = iris$Species, border = col)