View source: R/outliermethods.R
| mahal | R Documentation |
Flags outliers based on Mahalanobis distance matrix for all records.
mahal(
data,
exclude = NULL,
output = "outlier",
mode = "soft",
pdf = 0.95,
tol = 1e-20,
pc = FALSE,
boot = FALSE,
var,
pcvar = NULL
)
data |
|
exclude |
|
output |
|
mode |
|
pdf |
|
tol |
|
pc |
Whether principal component analysis will be computed. Default |
boot |
Whether bootstrapping will be computed. Default |
var |
The variable of concern, which is vital for univariate outlier detection methods |
pcvar |
Principal component analysis to e used for outlier detection after PCA. Default |
Either clean or outliers dataset
Leys C, Klein O, Dominicy Y, Ley C. 2018. Detecting multivariate outliers: Use a robust variant of the Mahalanobis distance. Journal of Experimental Social Psychology 74:150-156.
data("efidata")
danube <- system.file('extdata/danube.shp.zip', package='specleanr')
db <- sf::st_read(danube, quiet=TRUE)
wcd <- terra::rast(system.file('extdata/worldclim.tiff', package='specleanr'))
refdata <- pred_extract(data = efidata, raster= wcd ,
lat = 'decimalLatitude',
lon= 'decimalLongitude',
colsp = "scientificName",
bbox = db,
minpts = 10)
#outliers
outliers <- mahal(data = refdata[["Thymallus thymallus"]], exclude = c("x", "y"),
output='outlier')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.