Description Usage Arguments Value Examples
View source: R/outliers_mahalanobis.R
Detecting multivariate outliers using the Mahalanobis distance
1 | outliers_mahalanobis(x, alpha, na.rm)
|
x |
matrix of bivariate values from which we want to compute outliers |
alpha |
nominal type I error probability (by default .01) |
na.rm |
set whether Missing Values should be excluded (na.rm = TRUE) or not (na.rm = FALSE) - defaults to TRUE |
Returns Call, Max distance, number of outliers
1 2 3 4 5 6 7 8 9 10 11 | #### Run outliers_mahalanobis
data(Attacks)
SOC <- rowMeans(Attacks[,c("soc1r","soc2r","soc3r","soc4","soc5","soc6","soc7r",
"soc8","soc9","soc10r","soc11","soc12","soc13")])
HSC <- rowMeans(Attacks[,22:46])
res <- outliers_mahalanobis(x = cbind(SOC,HSC), na.rm = TRUE)
# A list of elements can be extracted from the function,
# such as the position of outliers in the dataset
# and the coordinates of outliers
res$outliers_pos
res$outliers_val
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.