R/outlier-dist.R
maha_trans.Rd
Transform matrix to use Mahalanobis distance instead of Euclidean one.
maha_trans(U, estim = covrob_ogk(U))
A matrix (e.g. PC scores).
List of location and scatter estimates, $cov and $center.
$cov
$center
U, transformed.
U
X <- readRDS(system.file("testdata", "three-pops.rds", package = "bigutilsr")) svd <- svds(scale(X), k = 5) U <- svd$u dist1 <- dist_ogk(U) U.maha <- maha_trans(U) dist2 <- rowSums(U.maha^2) all.equal(dist2, dist1) #> [1] TRUE