maha_d: Mahalanobis distance

Description Usage Arguments Examples

View source: R/distances.R

Description

A wrapper for stats::mahalanobis

Computes the mahalanobis distance and adds it to the end of the data.frame as well as the outlier p-value.

Usage

1
2
3
maha_d(x, .f = mean, inverted = FALSE)

add_maha_d(df, cols = NULL, .f = mean, inverted = FALSE)

Arguments

x

A data.frame or matrix of numeric values

.f

The centering function. Defaults to use 'mean'.

inverted

Logical. If TRUE, the covariance matrix (p x p) of the distribution is supposed to contain the inverse of the covariance matrix.

df

The data.frame to add

cols

A character vector of the columns to select from the data.frame

Examples

1
2
maha_d(iris[1:3])
add_maha_d(iris[1:3])

jmbarbone/qpm documentation built on July 25, 2020, 10:41 p.m.