Compute Pairwise Robust Mahalanobis Distances
pairwise_dist.robustmahadist.Rd
Returns a full NxN matrix of robust Mahalanobis distances, using a robust covariance estimator. No block-based exclusion is performed.
Details
- Estimates a robust covariance with robustcov::covGK(X)
(make sure the robustcov
package is installed).
- Then calls corpcor::invcov.shrink
to get an inverse covariance estimate.
- Finally, loops over row pairs to compute (x_i - x_j) * inv_cov * (x_i - x_j)^T
.
Examples
if (FALSE) { # \dontrun{
library(robustcov)
X <- matrix(rnorm(100), 10, 10)
dist_obj <- robustmahadist()
dist_matrix <- pairwise_dist(dist_obj, X)
} # }