| mv_outlier | R Documentation | 
Computes robust Mahalanobis distances for multivariate data using the Minimum Covariance Determinant (MCD) estimator, flags outliers based on either a chi-square quantile cutoff or an adjusted cutoff using the Atkinson–Riani–Welsh (ARW) method, and optionally generates a Mahalanobis Q–Q plot.
mv_outlier(
  data,
  outlier = TRUE,
  qqplot = TRUE,
  alpha = 0.05,
  method = c("quan", "adj"),
  label = TRUE,
  title = "Chi-Square Q-Q Plot"
)
| data | A numeric matrix or data frame with observations in rows and at least two numeric columns. | 
| outlier | Logical; if  | 
| qqplot | Logical; if  | 
| alpha | Numeric; significance level used for the adjusted cutoff method (only applies if  | 
| method | Character string specifying the outlier detection method. Must be either  | 
| label | Logical; if  | 
| title | Optional character string specifying the title for the Q–Q plot. Default is  | 
A list containing the following components:
outlier, a data frame of Mahalanobis distances with observation IDs and outlier flags (if outlier = TRUE);
qq_outlier_plot, a ggplot object of the Mahalanobis Q–Q plot (if qqplot = TRUE);
and newData, a data frame of non-outlier observations.
## Not run: 
data <- iris[, 1:4]
res <- mv_outlier(data, method = "adj", alpha = 0.025)
res$outlier
res$qq_outlier_plot
head(res$newData)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.