ellipseParam {HotellingEllipse}R Documentation

Lengths Of The Semi-Axes Of Hotelling Ellipse

Description

Compute the lengths of the semi-axes of Hotelling ellipse.

Usage

ellipseParam(data, k = 2, pcx = 1, pcy = 2)

Arguments

data

Data frame or tibble of PCA, PLS, or ICA scores, or from other feature projection methods.

k

Integer specifying the number of components (by default 2).

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).

Value

Returns a list that includes:

  1. Tsquare Data frame containing the T-squared statistic.

  2. Ellipse Data frame containing the lengths of the semi-minor and semi-major axes.

  3. cutoff.99pct Number corresponding to the T-square cutoff at 99% confidence level.

  4. cutoff.95pct Number corresponding to the T-square cutoff at 95% confidence level.

Author(s)

Christian L. Goueguel, christian.goueguel@gmail.com

Examples

## 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 T2-value and the lengths of the ellipse semi-axes
library(HotellingEllipse)
T2 <- ellipseParam(data = pca_scores, k = 2, pcx = 1, pcy = 2)


[Package HotellingEllipse version 1.1.0 Index]