shapley_interaction {ShapleyOutlier} | R Documentation |
Decomposition of squared Mahalanobis distance using Shapley interaction indices.
Description
The shapley_interaction
function computes a p \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 |
mu |
Either |
Sigma |
Either |
inverted |
Logical. If |
Value
A p \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)