scordis {rchemo} | R Documentation |
Score distances (SD) in a PCA or PLS score space
Description
scordis
calculates the score distances (SD) for a PCA or PLS model. SD is the Mahalanobis distance of the projection of a row observation on the score plan to the center of the score space.
A distance cutoff is computed using a moment estimation of the parameters of a Chi-squared distrbution for SD^2 (see e.g. Pomerantzev 2008). In the function output, column dstand
is a standardized distance defined as SD / cutoff
. A value dstand > 1
can be considered as extreme.
The Winisi "GH" is also provided (usually considered as extreme if GH > 3).
Usage
scordis(
object, X = NULL,
nlv = NULL,
rob = TRUE, alpha = .01
)
Arguments
object |
A fitted model, output of a call to a fitting function (for example from |
X |
New X-data. |
nlv |
Number of components (PCs or LVs) to consider. |
rob |
Logical. If |
alpha |
Risk- |
Value
res.train |
matrix with distances, standardized distances and Winisi "GH", for the training set. |
res |
matrix with distances, standardized distances and Winisi "GH", for new X-data if any. |
cutoff |
cutoff value |
References
M. Hubert, P. J. Rousseeuw, K. Vanden Branden (2005). ROBPCA: a new approach to robust principal components analysis. Technometrics, 47, 64-79.
Pomerantsev, A.L., 2008. Acceptance areas for multivariate classification derived by projection methods. Journal of Chemometrics 22, 601-609. https://doi.org/10.1002/cem.1147
Examples
n <- 6 ; p <- 4
Xtrain <- matrix(rnorm(n * p), ncol = p)
ytrain <- rnorm(n)
Xtest <- Xtrain[1:3, , drop = FALSE]
nlv <- 3
fm <- pcasvd(Xtrain, nlv = nlv)
scordis(fm)
scordis(fm, nlv = 2)
scordis(fm, Xtest, nlv = 2)