hist_out: Outlier detection (histogram)

Description Usage Arguments Value Examples

View source: R/outlier-hist.R

Description

Outlier detection based on departure from histogram. Suitable for compact values (need a space between main values and outliers).

Usage

1
hist_out(x, breaks = nclass.scottRob, pmax_out = 0.2, nboot = NULL)

Arguments

x

Numeric vector (with compact values).

breaks

Same parameter as for hist(). Default uses a robust version of Scott's rule. You can also use "FD" or nclass.FD for a bit more bins.

pmax_out

Percentage at each side that can be considered outliers at each step. Default is 0.2.

nboot

Number of bootstrap replicates to estimate limits more robustly. Default is NULL (no bootstrap, even if I would recommend to use it).

Value

A list with

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(1)
x <- rnorm(1000)
str(hist_out(x))

# Easy to separate
x2 <- c(x, rnorm(50, mean = 7))
hist(x2, breaks = nclass.scottRob)
str(hist_out(x2))

# More difficult to separate
x3 <- c(x, rnorm(50, mean = 6))
hist(x3, breaks = nclass.scottRob)
str(hist_out(x3))
str(hist_out(x3, nboot = 999))

bigutilsr documentation built on April 14, 2021, 1:06 a.m.