ellipseCoord {HotellingEllipse} | R Documentation |
Get the x and y coordinates of Hotelling ellipse.
ellipseCoord(data, pcx = 1, pcy = 2, conf.limit = 0.95, pts = 200)
data |
Data frame or tibble of PCA, PLS, and ICA scores, or from other feature projection methods. |
pcx |
Integer specifying which component is on the x-axis (by default 1). |
pcy |
Integer specifying which component is on the y-axis (by default 2). |
conf.limit |
Number between 0 and 1 specifying the confidence level (by default 0.95). |
pts |
Integer indicating the number of points for drawing the Hotelling ellipse (by default 200). |
Data frame containing the x and y coordinate points of the Hotelling ellipse.
Christian L. Goueguel, christian.goueguel@gmail.com
## Principal components analysis (PCA)
library(dplyr)
set.seed(123)
pca_mod <- specData %>%
dplyr::select(where(is.numeric)) %>%
FactoMineR::PCA(scale.unit = FALSE, graph = FALSE)
## Extract PCA scores
pca_scores <- pca_mod %>%
purrr::pluck("ind", "coord") %>%
tibble::as_tibble()
## Get Hotelling ellipse coordinate points
library(HotellingEllipse)
xy_coord <- ellipseCoord(data = pca_scores, pcx = 1, pcy = 2, conf.limit = 0.95, pts = 200)