Learn R Programming

ShapleyOutlier (version 0.1.2)

shapley_interaction: 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 Mayrhofer2022ShapleyOutlier.

Usage

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

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.

Arguments

x

Data vector with \(p\) 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 \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.

References

Mayrhofer2022ShapleyOutlier

Examples

Run this code
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)

Run the code above in your browser using DataLab