dist_mah | R Documentation |
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.
dist_mah(x, group, alpha)
x |
|
group |
|
alpha |
|
A numeric value of distance
Jung Ae Lee <jungae.lee@umassmed.edu>
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.