locOuts: Local Outlier Detection using Spatially Smoothed MRCD

View source: R/locOuts.R

locOutsR Documentation

Local Outlier Detection using Spatially Smoothed MRCD

Description

Identifies local multivariate outliers using spatially smoothed robust covariance estimation (ssMRCD) as proposed by Puchhammer and Filzmoser (2023). For each observation, the Mahalanobis distance to its nearest neighbor is computed, and an adjusted boxplot is used to detect outliers.

Usage

locOuts(data, coords, groups, lambda, weights = NULL, k = NULL, dist = NULL)

Arguments

data

A numeric matrix of observations (rows = observations, columns = variables).

coords

A numeric matrix of spatial coordinates corresponding to the observations.

groups

A vector assigning each observation to a neighborhood/group.

lambda

Smoothing parameter for the ssMRCD estimator.

weights

Optional weighting matrix for spatial smoothing. If omitted, inverse-distance weights are computed automatically.

k

Integer. Number of nearest neighbors to use if dist is not provided.

dist

Numeric. Use neighbors within this distance instead of k-nearest neighbors. If both are provided, dist is used.

Value

An object of class "locOuts" containing:

outliers

Indices of detected outliers.

next_distance

Vector of Mahalanobis next distances (min distance to neighbors).

cutoff

Upper fence of the adjusted boxplot used as outlier threshold.

coords

Matrix of observation coordinates.

data

Original data matrix.

groups

Group assignments.

k, dist

Neighborhood comparison parameters used.

centersN

Centers of neighborhoods.

matneighbor

Binary matrix indicating which neighbors were used for each observation.

ssMRCD

The fitted ssMRCD object.

References

Puchhammer, P. and Filzmoser, P. (2023). Spatially Smoothed Robust Covariance Estimation for Local Outlier Detection. *Journal of Computational and Graphical Statistics*, 33(3), 928–940. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/10618600.2023.2277875")}

See Also

ssMRCD, plot.locOuts

Examples

data <- matrix(rnorm(2000), ncol = 4)
coords <- matrix(runif(1000), ncol = 2)
groups <- sample(1:10, 500, replace = TRUE)
result <- locOuts(data, coords, groups, lambda = 0.3, k = 10)

ssMRCD documentation built on Nov. 5, 2025, 7:44 p.m.