find_outlier: Detect outliers

Description Usage Arguments Value Examples

Description

Outliers are detected if it is larger than Q3 + lambda * (Q3-Q1) or smaller than Q1 - lambda * (Q3-Q1), where Q3 and Q1 are the third and first quantile of x.

Usage

1
find_outlier(x, lambda = 1.5)

Arguments

x

A numeric vector.

lambda=1.5,

a number decribes the "distance" from the group x. The larger the lambda is, the number of outliers captured is less.

Value

A list contains a character vector names is_outlier that indicates whether it is outier ("yes", "no"), and a numeric vector named "bounds" that stores the upper cutting line and lower cutting line.

Examples

1
2
3
4
x = rnorm(100, 0, 1)
idx = c(1, 5, 10, 21, 30)
x[idx] = x[idx] + 5
find_outlier(x, lambda = 1.5)

placeboo/amplify documentation built on Oct. 6, 2020, 9:04 a.m.