epi_stats_count_outliers: Count univariate outliers

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/epi_stats_count_outliers.R

Description

epi_stat_count_outliers() counts how many outliers a vector has using a univariate approach. Returns the number of observations that are greater than the cutoff. Outliers are detected with the Tukey method (above and below coef * IQR).

Usage

1

Arguments

num_vec

Numeric vector to test.

coef

Coefficient for outlier detection, default is 1.5

...

Other parameters that can be passed to boxplot.stats().

Value

Returns the number of observations above the cut-off specified.

Note

coef = 0 returns no outliers, see ?boxplot.stats An alternative, not implemented, is to consider those eg > 5 * SD

Author(s)

Antonio J Berlanga-Taylor <https://github.com/AntonioJBT/episcout>

See Also

boxplot.stats

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
n <- 1000
df <- data.frame(var_id = rep(1:(n / 2), each = 2),
                var_to_rep = rep(c("Pre", "Post"), n / 2),
                x = rnorm(n),
                y = rbinom(n, 1, 0.50),
                z = rpois(n, 2)
               )
epi_head_and_tail(df)
epi_stat_count_outliers(num_vec = df$x, coef = 0)
epi_stat_count_outliers(num_vec = df$x)
summary(df$x)


## End(Not run)

AntonioJBT/episcout documentation built on Nov. 7, 2019, 5:34 p.m.