Affiliation:
1. Libera Università Maria SS. Assunta
Abstract
Abstract
Mahalanobis distance is a measure of dissimilarity between two vectors of multi- variate random variables, based on the covariance matrix. This distance is useful for statistical matching or statistical fusion of data, as well as for detecting differ- ences between factors. In this paper, we present the cmahalanobis package, a R package that provides a function to compute the Mahalanobis distance between every pair of species in a list of data frames. Each data frame contains the obser- vations of a species with some variables. The cmahalanobis package is based on the formula of the Mahalanobis distance and exploits the stats functions of R for matrix computation. The cmahalanobis package offers several options for han- dling missing data, standardizing variables, and selecting relevant variables. The cmahalanobis package differs from other similar packages for its simplicity, flexi- bility, and speed. We show some applications of the cmahalanobis package with real data sets embedded in R, such as mtcars and iris, and with the BFI dataset RDocumentation and William Revelle (2024), which contains 2800 observations and 25 personality items representing five factors that are: Agreeableness, Consci- entiousness, Extraversion, Neuroticism, and Opennness. We illustrate the results with graphs and tables. We conclude that the cmahalanobis package is an effec- tive and practical tool for computing the Mahalanobis distance, and we suggest some possible extensions or improvements for the future of the package
Publisher
Research Square Platform LLC