Skip to contents

Computes and draws a confidence/tolerance ellipse.

Usage

ternary_ellipse(x, y, z, ...)

ternary_confidence(x, y, z, ...)

ternary_tolerance(x, y, z, ...)

# S4 method for numeric,numeric,numeric
ternary_ellipse(x, y, z, radius = 1, ...)

# S4 method for ANY,missing,missing
ternary_ellipse(x, radius = 1, ...)

# S4 method for numeric,numeric,numeric
ternary_confidence(x, y, z, level = 0.95, ...)

# S4 method for ANY,missing,missing
ternary_confidence(x, level = 0.95, ...)

# S4 method for numeric,numeric,numeric
ternary_tolerance(x, y, z, level = 0.95, ...)

# S4 method for ANY,missing,missing
ternary_tolerance(x, level = 0.95, ...)

Arguments

x, y, z

A numeric vector giving the x, y and z ternary coordinates of a set of points. If y and z are missing, an attempt is made to interpret x in a suitable way (see grDevices::xyz.coords()).

...

Further arguments to be passed to graphics::polygon().

radius

A numeric vector specifying the scaling of the half-diameters.

level

A numeric vector specifying the confidence/tolerance level.

Value

ternary_ellipse() is called it for its side-effects.

See also

Author

N. Frerebeau

Examples

## Compositional data
coda <- data.frame(
  X = c(96, 49, 57, 92, 62, 85, 75, 76, 30, 36,
        55, 93, 78, 10, 50, 69, 50, 91, 13, 24),
  Y = c(59, 90, 18, 99, 80, 22, 74, 43, 68, 80,
        30, 84, 84, 48, 79, 53, 32, 91, 19, 48),
  Z = c(33, 88, 7, 58, 81, 16, 48, 91, 85, 12,
        94, 81, 32, 39, 39, 32, 65, 35, 4, 12)
)

## Ellipse
ternary_plot(coda, panel.first = ternary_grid(5, 10))
ternary_tolerance(coda, level = 0.95, border = "blue", lty = 2)
ternary_confidence(coda, level = 0.95, border = "red", lty = 3)