Skip to contents

Formula: \(MD(z) = 1/(1 + (z-\mu)' \Sigma^{-1} (z-\mu))\). Depth is 1 exactly at \(\mu\) and decreases monotonically outwards, so a depth ordering is a centre-outward ordering; the map is affine invariant because \(\Sigma^{-1}\) absorbs any non-singular linear transform. Defaults are the sample mean and the sample covariance with divisor n-1, which makes the depth non-robust: one far outlier inflates \(\Sigma\) and flattens every depth.

Usage

Mahaldep(x, mu = NULL, Sigma = NULL)

Arguments

x

n by p matrix of points, one per row.

mu

Centre; column means if NULL.

Sigma

Scatter matrix; sample covariance if NULL.

Value

List with depth, estimate (maximum depth), deepest (0-based row index), d2, n, p, method.

References

Liu (1990), Annals of Statistics 18:405-414, introduces data depth as a centre-outward ordering; the Mahalanobis form 1/(1+d^2) is that of Liu and Singh (1993), JASA 88:252-260, using Mahalanobis (1936). The Project Euclid PDF for Liu (1990) could not be retrieved from this host (the fetch returned a 1.2 kB error page), so this is the standard published form, anchored in the harness on depth(mu) = 1 exactly and on affine invariance – neither of which depends on this code.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Mahaldep(V)
#> $depth
#> [1] 0.3287671 0.4897959 0.7272727 0.9600000 0.9600000 0.7272727 0.4897959
#> [8] 0.3287671
#> 
#> $estimate
#> [1] 0.96
#> 
#> $deepest
#> [1] 3
#> 
#> $d2
#> [1] 2.04166667 1.04166667 0.37500000 0.04166667 0.04166667 0.37500000 1.04166667
#> [8] 2.04166667
#> 
#> $n
#> [1] 8
#> 
#> $p
#> [1] 1
#> 
#> $method
#> [1] "Mahalanobis depth"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"