Compute the coordinate points of confidence ellipses at a specified confidence level.
Arguments
- .data
data frame or tibble.
- x
column name for the x-axis variable.
- y
column name for the y-axis variable.
- .group_by
column name for the grouping variable (
NULL
by default). Note that this grouping variable must be a factor.- conf_level
confidence level for the ellipse (0.95 by default).
- robust
optional (
FALSE
by default). When set toTRUE
, it indicates that robust estimation method is employed to calculate the coordinates of the ellipse. The location is the 1-step M-estimator with the biweight psi function. The scale is the Minimum Covariance Determinant (MCD) estimator. Raymaekers and Rousseeuw (2019).
Examples
# Data
data("glass", package = "ConfidenceEllipse")
# Confidence ellipse
ellipse <- confidence_ellipse(.data = glass, x = SiO2, y = Na2O)
ellipse_grp <- confidence_ellipse(
.data = glass,
x = SiO2,
y = Na2O,
.group_by = glassType
)