Skip to contents

Outlier detection based on Z-scores for symetric distributions. The function calculates the Z-score, i. e. the distance of a value from the mean in number of standard deviations.

Usage

is_outlier_z(x, threshold = 3, na.rm = TRUE)

Arguments

x

A vector of numeric values.

threshold

Z-score threshold (defaults to 3).

na.rm

Remove NAs, defaults to TRUE.

Value

A logical vector.

Examples


x <- c(1, 2, 3, 3, 4, 4, 4, 5, 5.5, 6, 6, 6.5, 7, 7, 7.5, 8, 9, 12, 52, 90)

is_outlier_z(x)
#>  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE