deltacapsq: Squared Mahalanobis Distance

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/linearAlgebra-deltacapsq.R

Description

Calculates the squared Mahalanobis distance.

Usage

1
deltacapsq(x, mu, sigmacap)

Arguments

x

Numeric vector or matrix.

mu

Numeric vector. Center \boldsymbol{μ}.

sigmacap

Numeric matrix. Covariance matrix \boldsymbol{Σ}.

Details

The squared Mahalanobis distance is given by

\boldsymbol{Δ}^{2} = ≤ft( \mathbf{x} - \boldsymbol{μ} \right)^{\prime} \boldsymbol{Σ}^{-1} ≤ft( \mathbf{x} - \boldsymbol{μ} \right)

Value

A vector.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Wikipedia: Mahalanobis distance

See Also

Other Scaling Functions: d(), z()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
x <- matrix(
  data = stats::rnorm(n = 5 * 2),
  ncol = 2
)

deltacapsq(
  x,
  mu = c(0, 0),
  sigmacap = diag(2)
)

x <- rnorm(5)

deltacapsq(
  x,
  mu = 0,
  sigmacap = 1
)

jeksterslab/linearAlgebra documentation built on Dec. 20, 2021, 10:10 p.m.