dist_mah {distanceHD}R Documentation

ridge Mahalanobis distance between two groups

Description

Calculate the Mahalanobis distance between two groups in a high-dimensional space (d > n), using a ridge correction on the covariance matrix to ensure invertibility. The method also supports a single-member cluster and works in low-dimensional settings without a ridge correction.

Usage

dist_mah(x, group, alpha)

Arguments

x

x is n by d matrix

group

group is a binary group label with the length of n1 and n2

alpha

alpha is a positive numeric value representing the ridge correction constant. If not specified, the default value is set to \sqrt{\log(d)/n}.

Value

A numeric value of distance

Author(s)

Jung Ae Lee <jungae.lee@umassmed.edu>

Examples

data(leukemia)
group = leukemia$Y      # 38 patients status with a value of 1 or 2
x = leukemia$X          # 38 x 3051 genes

# apply the function
dist_mah(x, group)   # 26.8 

# default alpha
d = 3051; n = 38
alpha = sqrt(log(d)/n)
dist_mah(x, group, alpha)   # 26.8

[Package distanceHD version 1.2 Index]