Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

maha_trans

Transform matrix


Description

Transform matrix to use Mahalanobis distance instead of Euclidean one.

Usage

maha_trans(U, estim = covrob_ogk(U))

Arguments

U

A matrix (e.g. PC scores).

estim

List of location and scatter estimates, $cov and $center.

Value

U, transformed.

Examples

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)

bigutilsr

Utility Functions for Large-scale Data

v0.3.4
GPL-3
Authors
Florian Privé [aut, cre]
Initial release
2021-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.