Calculates Hotelling T^2 (score distance) and Q-residual (orthogonal distance) for each observation, given a chosen number of components.
pca_outliers(x, X, ncomp, cutoff = FALSE)A data frame with columns T2 and Q, and optionally an outlier flag.
A pca object.
The original data matrix used for PCA.
Number of components to consider.
Logical or numeric specifying threshold for labeling outliers. If TRUE,
uses some typical statistical threshold (F-dist) for T^2, or sets an arbitrary Q limit.
If numeric, treat it as a cutoff. Default is FALSE (no labeling).