isoutlier

bv = isoutlier(x; critic=3.0, method::Symbol=:median, threshold=nothing, width=0.0) -> Union{BitVector, BitMatrix}

Return a logical array whose elements are true when an outlier is detected in the corresponding element of x.

If x is a matrix, and width is not used, then isoutlier operates on each column of x separately. By default, an outlier is a value that is more than three median absolute deviations (MAD) from the median. But that can be changed via the critic option.

Examples

x = [57, 59, 60, 100, 59, 58, 57, 58, 300, 61, 62, 60, 62, 58, 57];
findall(isoutlier(x))
2-element Vector{Int64}:
 4
 9
x = -50.0:50;   y = x / 50 .+ 3 .+ 0.25 * rand(length(x));
y[[30,50,60]] = [4,-3,6];   # Add 3 outliers
findall(isoutlier([x y], width=9))

Source Code

This function has multiple methods: