| bd_row {anomalyDetection} | R Documentation |
bd_row indicates which variables in data are driving the Mahalanobis
distance for a specific row r, relative to the mean vector of the data.
bd_row(data, row, n = NULL)
data |
numeric data |
row |
row of interest |
n |
number of values to return. By default, will return all variables
(columns) with their respective differences. However, you can choose to view
only the top |
Returns a vector indicating the variables in data that are driving the
Mahalanobis distance for the respective row.
mahalanobis_distance for computing the Mahalanobis Distance values
## Not run:
x = matrix(rnorm(200*3), ncol = 10)
colnames(x) = paste0("C", 1:ncol(x))
# compute the relative differences for row 5 and return all variables
x %>%
mahalanobis_distance("bd", normalize = TRUE) %>%
bd_row(5)
# compute the relative differences for row 5 and return the top 3 variables
# that are influencing the Mahalanobis Distance the most
x %>%
mahalanobis_distance("bd", normalize = TRUE) %>%
bd_row(5, 3)
## End(Not run)