Learn R Programming

dimensio (version 0.14.1)

viz_confidence: Confidence Ellipses

Description

Plots confidence ellipses.

Usage

viz_confidence(x, y, ...)

wrap_confidence(x, y, ...)

# S4 method for numeric,numeric viz_confidence( x, y, ..., group = NULL, level = 0.95, color = NULL, fill = FALSE, symbol = FALSE )

# S4 method for MultivariateAnalysis,missing viz_confidence( x, ..., group = NULL, level = 0.95, color = NULL, fill = FALSE, symbol = FALSE )

# S4 method for MultivariateBootstrap,missing viz_confidence( x, ..., level = 0.95, color = FALSE, fill = FALSE, symbol = FALSE )

# S4 method for PCOA,missing viz_confidence( x, ..., axes = c(1, 2), group = NULL, level = 0.95, color = NULL, fill = FALSE, symbol = FALSE )

# S4 method for numeric,numeric wrap_confidence(x, y, group = NULL, level = 0.95)

# S4 method for MultivariateAnalysis,missing wrap_confidence( x, margin = 1, axes = c(1, 2), group = NULL, level = 0.95, principal = TRUE )

# S4 method for PCOA,missing wrap_confidence(x, axes = c(1, 2), group = NULL, level = 0.95)

Value

wrap_confidence() 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_confidence()is called for its side-effects: it results in a graphic being displayed. Invisibly returns x.

Arguments

x, y

A numeric vector. If y is missing, x must be an object from which to wrap observations (a CA, MCA or PCA object).

...

Further graphical parameters to be passed to graphics::polygon().

group

A vector specifying the group an observation belongs to.

level

A numeric vector specifying the confidence/tolerance level.

color

The colors for borders (will be mapped to group). Ignored if set to FALSE. If NULL, the default color scheme will be used.

fill

The background colors (will be mapped to group). Ignored if set to FALSE.

symbol

A vector of symbols (will be mapped to group). Ignored if set to FALSE.

axes

A length-two numeric vector giving the dimensions for which to compute results.

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.

principal

A logical scalar: should principal coordinates be used? If FALSE, standard coordinates are returned.

Author

N. Frerebeau

See Also

Other envelopes: viz_ellipses(), viz_hull(), viz_tolerance()

Examples

Run this code
## Load data
data("iris")

## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_quali = "Species")

## Compute confidence ellipse coordinates
conf <- wrap_confidence(X, margin = 1, group = "Species", level = 0.95)

## Plot confidence ellipses
col <- c("#004488", "#DDAA33", "#BB5566")
viz_rows(X, extra_quali = iris$Species, color = col)
viz_confidence(X, group = iris$Species, color = col, level = 0.95)

Run the code above in your browser using DataLab