Learn R Programming

DescTools (version 0.99.56)

LOF: Local Outlier Factor

Description

A function that finds the local outlier factor (Breunig et al.,2000) of the matrix "data" using k neighbours. The local outlier factor (LOF) is a measure of outlyingness that is calculated for each observation. The user decides whether or not an observation will be considered an outlier based on this measure. The LOF takes into consideration the density of the neighborhood around the observation to determine its outlyingness.

Usage

LOF(data, k)

Value

lof

A vector with the local outlier factor of each observation

Arguments

data

The data set to be explored

k

The kth-distance to be used to calculate the LOF's.

Author

Caroline Rodriguez

Details

The LOFs are calculated over a range of values, and the max local outlier factor is determined over this range.

References

Breuning, M., Kriegel, H., Ng, R.T, and Sander. J. (2000). LOF: Identifying density-based local outliers. In Proceedings of the ACM SIGMOD International Conference on Management of Data

Examples

Run this code
# Detecting the top 10 outliers using the LOF algorithm

(iris.lof <- LOF(iris[,-5], 10))

Run the code above in your browser using DataLab