mahalanobis_dist: Calculate Mahalanobis distances (tolerant to non positive...

Description Usage Arguments Value Examples

Description

the difference between this and the base function mahalanobis is that this can tolerate a non positive-semidefinite covariance matrix.

Usage

1
2
3
4
5
6
7
mahalanobis_dist(
  x,
  center = colMeans,
  cov = function(x) crossprod(x)/nrow(x),
  inverted = FALSE,
  tol = 1e-12
)

Arguments

x

a matrix of numeric data

center

defaults to column medians but a vector of means or other location measures can be supplied.

cov

either a covariance matrix or a function to calculate one. defaults to an adaptive huber method.

inverted

defaults to FALSE. change to true if you are providing a precision matrix.

tol

tolerance

Value

a vector

Examples

1

abnormally-distributed/cvreg documentation built on May 3, 2020, 3:45 p.m.