shapley_interaction {ShapleyOutlier}R Documentation

Decomposition of squared Mahalanobis distance using Shapley interaction indices.

Description

The shapley_interaction function computes a p×pp \times p matrix containing pairwise outlyingness scores based on Shapley interaction indices. It decomposes the squared Mahalanobis distance of x (with respect to mu and Sigma) into outlyingness contributions of pairs of variables (Mayrhofer and Filzmoser 2022).

Usage

shapley_interaction(x, mu, Sigma, inverted = FALSE)

Arguments

x

Data vector with pp entries containing only numeric entries.

mu

Either NULL (default) or mean vector of x. If NULL, method is used for parameter estimation.

Sigma

Either NULL (default) or covariance matrix p×pp \times p of x. If NULL, method is used for parameter estimation.

inverted

Logical. If TRUE, Sigma is supposed to contain the inverse of the covariance matrix.

Value

A p×pp \times p matrix containing the decomposition of the squared Mahalanobis distance of x into outlyingness scores for pairs of variables with respect to mu and Sigma.

References

Mayrhofer M, Filzmoser P (2022). “Multivariate outlier explanations using Shapley values and Mahalanobis distances.” doi:10.48550/ARXIV.2210.10063.

Examples

p <- 5
mu <- rep(0,p)
Sigma <- matrix(0.9, p, p); diag(Sigma) = 1
Sigma_inv <- solve(Sigma)
x <- c(0,1,2,2.3,2.5)
shapley_interaction(x, mu, Sigma)
PHI <- shapley_interaction(x, mu, Sigma_inv, inverted = TRUE)
plot(PHI)

[Package ShapleyOutlier version 0.1.1 Index]