Skip to contents

Returns a full NxN matrix of robust Mahalanobis distances, using a robust covariance estimator. No block-based exclusion is performed.

Usage

# S3 method for class 'robustmahadist'
pairwise_dist(obj, X)

Arguments

obj

A distance function object of class c("robustmahadist", "distfun").

X

A numeric matrix.

Value

An N x N numeric matrix of pairwise robust Mahalanobis distances.

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)
} # }