mahal_dist: Mahalanobis Distance

Description Usage Arguments Value Examples

Description

Calculates a Mahalanobis distance of a dataframe or a matrix. Option for robust centroid location.The Mahalanobis distance is a measure of distance between a point and a distribution. In this simplified case it's the difference between each point and centroid of the distribution produced by the points.

Usage

1
mahal_dist(x, center = "mean", na.rm = TRUE)

Arguments

x

Dataframe or matrix of numerical values

center

Method to calculate distribution center, either mean or median

na.rm

Whether to remove missing values for centroid calculation

Value

vector of distances

Examples

1
2
3
4
5
data(iris)

iris_values <- iris[,1:4]
mahal_dist(iris_values)
mahal_dist(iris_values, center = "median")

Swarchal/phenoDist documentation built on May 9, 2019, 3:25 p.m.