Local Outlier Factor (LOF) calculator

Detect local anomalies and outliers in multi-dimensional data using the Local Outlier Factor (LOF) algorithm online.

What it does

You have no confirmed examples of 'unusual' cases and care about points odd relative to their local neighbourhood (not just globally rare), so a density-based method that compares each point's local density to its neighbours' fits better than a single global rule.

When to use it

Each point gets an anomaly score reflecting how much less dense its neighbourhood is than its neighbours' neighbourhoods — high scores mean 'locally unusual', not 'rare in an absolute sense'.

Worked example

You are screening transactions for fraud. A £5,000 payment is not unusual for a corporate account but is very unusual for a student one. LOF compares each point with its own neighbours rather than with the dataset as a whole, so it flags what is odd in context rather than merely large.

Cautions

Alternatives

How to read the output

The LOF score
Around 1 means the point is as densely surrounded as its neighbours are. Above 1 means it sits in a relatively sparse patch; points above 1.5 are flagged here. The threshold is a convention, not a test. There is no p-value: this is a ranking, and the cut is where you decide to stop reading.
Neighbours (k)
How many neighbours define 'locally'. Small k reacts to individual gaps; large k approaches a global notion of outlyingness. k must be smaller than the sample; it is capped automatically. A point that is flagged at one k and not at another has not been shown to be anything — sweep k before trusting a flag.
Whether the data were scaled
Every method here works on distances, and a distance adds up your columns' units. Standardizing puts each variable on the same footing before that sum is taken. Unscaled, the variable with the largest numeric range silently becomes the clustering. Income in pounds against age in years is a clustering of income. Turn scaling off only when the raw units are genuinely comparable and you mean to keep their relative weight.
What a flag means
That the point is unusual in the variables you selected. Nothing about whether it is wrong. Never delete rows because they were flagged. Go and look at them: an anomaly is a data-entry error, a genuinely unusual subject, or the most interesting case in the file, and only inspection distinguishes those.

How this calculator is validated · Which statistical test should I use?