Plots tolerance ellipses.
Usage
viz_tolerance(x, y, ...)
wrap_tolerance(x, y, ...)
# S4 method for class 'numeric,numeric'
viz_tolerance(
x,
y,
...,
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
# S4 method for class 'MultivariateAnalysis,missing'
viz_tolerance(
x,
...,
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
# S4 method for class 'MultivariateBootstrap,missing'
viz_tolerance(
x,
...,
level = 0.95,
color = FALSE,
fill = FALSE,
symbol = FALSE
)
# S4 method for class 'PCOA,missing'
viz_tolerance(
x,
...,
group = NULL,
level = 0.95,
color = NULL,
fill = FALSE,
symbol = FALSE
)
# S4 method for class 'numeric,numeric'
wrap_tolerance(x, y, group = NULL, level = 0.95)
# S4 method for class 'MultivariateAnalysis,missing'
wrap_tolerance(
x,
margin = 1,
axes = c(1, 2),
group = NULL,
level = 0.95,
principal = TRUE
)
# S4 method for class 'PCOA,missing'
wrap_tolerance(x, axes = c(1, 2), group = NULL, level = 0.95)Arguments
- x, y
A
numericvector. Ifyis missing,xmust be an object from which to wrap observations (aCA,MCAorPCAobject).- ...
Further graphical parameters to be passed to
graphics::polygon().- group
A vector specifying the group an observation belongs to.
- level
A
numericvector specifying the confidence/tolerance level.- color
The colors for borders (will be mapped to
group). Ignored if set toFALSE. IfNULL, the default color scheme will be used.- fill
The background colors (will be mapped to
group). Ignored if set toFALSE.- symbol
A vector of symbols (will be mapped to
group). Ignored if set toFALSE.- margin
A length-one
numericvector giving the subscript which the data will be returned:1indicates individuals/rows (the default),2indicates variables/columns.- axes
A length-two
numericvector giving the dimensions for which to compute results.- principal
A
logicalscalar: should principal coordinates be used? IfFALSE, standard coordinates are returned.
Value
wrap_tolerance() returns a data.frame of envelope x and y
coordinates. An extra column named group is added specifying the group an
observation belongs to.
viz_tolerance()is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x.
See also
Other envelopes:
viz_confidence(),
viz_ellipses(),
viz_hull()
Examples
## Load data
data("iris")
## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")
## Compute tolerance ellipse coordinates
conf <- wrap_confidence(X, margin = 1, group = "Species", level = 0.95)
## Plot tolerance ellipses
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, extra_quali = iris$Species, color = col)
viz_tolerance(X, group = iris$Species, color = col, level = 0.95)
