Methods that power anomalize()

iqr(x, alpha = 0.05, max_anoms = 0.2, verbose = FALSE)

gesd(x, alpha = 0.05, max_anoms = 0.2, verbose = FALSE)

Arguments

x

A vector of numeric data.

alpha

Controls the width of the "normal" range. Lower values are more conservative while higher values are less prone to incorrectly classifying "normal" observations.

max_anoms

The maximum percent of anomalies permitted to be identified.

verbose

A boolean. If TRUE, will return a list containing useful information about the anomalies. If FALSE, just returns a vector of "Yes" / "No" values.

Value

Returns character vector or list depending on the value of verbose.

References

See also

anomalize()

Examples

set.seed(100) x <- rnorm(100) idx_outliers <- sample(100, size = 5) x[idx_outliers] <- x[idx_outliers] + 10 iqr(x, alpha = 0.05, max_anoms = 0.2)
#> [1] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [13] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [25] "No" "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" "No" #> [37] "Yes" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [49] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [61] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [73] "No" "No" "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" #> [85] "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" "Yes" "No" #> [97] "No" "No" "No" "No"
iqr(x, alpha = 0.05, max_anoms = 0.2, verbose = TRUE)
#> $outlier #> [1] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [13] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [25] "No" "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" "No" #> [37] "Yes" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [49] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [61] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [73] "No" "No" "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" #> [85] "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" "Yes" "No" #> [97] "No" "No" "No" "No" #> #> $outlier_idx #> [1] 37 31 90 95 80 #> #> $outlier_vals #> [1] 10.182908 9.908886 9.896230 9.469704 7.925595 #> #> $outlier_direction #> [1] "Up" "Up" "Up" "Up" "Up" #> #> $critical_limits #> limit_lower limit_upper #> -4.606339 4.827444 #> #> $outlier_report #> # A tibble: 20 x 7 #> rank index value limit_lower limit_upper outlier direction #> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> #> 1 1. 37. 10.2 -4.61 4.83 Yes Up #> 2 2. 31. 9.91 -4.61 4.83 Yes Up #> 3 3. 90. 9.90 -4.61 4.83 Yes Up #> 4 4. 95. 9.47 -4.61 4.83 Yes Up #> 5 5. 80. 7.93 -4.61 4.83 Yes Up #> 6 6. 64. 2.58 -4.61 4.83 No <NA> #> 7 7. 55. -2.27 -4.61 4.83 No <NA> #> 8 8. 96. 2.45 -4.61 4.83 No <NA> #> 9 9. 20. 2.31 -4.61 4.83 No <NA> #> 10 10. 75. -2.06 -4.61 4.83 No <NA> #> 11 11. 84. -1.93 -4.61 4.83 No <NA> #> 12 12. 50. -1.88 -4.61 4.83 No <NA> #> 13 13. 43. -1.78 -4.61 4.83 No <NA> #> 14 14. 52. -1.74 -4.61 4.83 No <NA> #> 15 15. 54. 1.90 -4.61 4.83 No <NA> #> 16 16. 58. 1.82 -4.61 4.83 No <NA> #> 17 17. 32. 1.76 -4.61 4.83 No <NA> #> 18 18. 89. 1.73 -4.61 4.83 No <NA> #> 19 19. 74. 1.65 -4.61 4.83 No <NA> #> 20 20. 57. -1.40 -4.61 4.83 No <NA> #>
gesd(x, alpha = 0.05, max_anoms = 0.2)
#> [1] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [13] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [25] "No" "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" "No" #> [37] "Yes" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [49] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [61] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [73] "No" "No" "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" #> [85] "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" "Yes" "No" #> [97] "No" "No" "No" "No"
gesd(x, alpha = 0.05, max_anoms = 0.2, verbose = TRUE)
#> $outlier #> [1] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [13] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [25] "No" "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" "No" #> [37] "Yes" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [49] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [61] "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" "No" #> [73] "No" "No" "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" #> [85] "No" "No" "No" "No" "No" "Yes" "No" "No" "No" "No" "Yes" "No" #> [97] "No" "No" "No" "No" #> #> $outlier_idx #> [1] 37 31 90 95 80 #> #> $outlier_vals #> [1] 10.182908 9.908886 9.896230 9.469704 7.925595 #> #> $outlier_direction #> [1] "Up" "Up" "Up" "Up" "Up" #> #> $critical_limits #> limit_lower limit_upper #> -3.441812 3.441812 #> #> $outlier_report #> # A tibble: 20 x 7 #> rank index value limit_lower limit_upper outlier direction #> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> #> 1 1. 37. 10.2 -3.45 3.45 Yes Up #> 2 2. 31. 9.91 -3.57 3.57 Yes Up #> 3 3. 90. 9.90 -3.55 3.55 Yes Up #> 4 4. 95. 9.47 -3.50 3.50 Yes Up #> 5 5. 80. 7.93 -3.55 3.55 Yes Up #> 6 6. 64. 2.58 -3.44 3.44 No <NA> #> 7 7. 96. 2.45 -3.41 3.41 No <NA> #> 8 8. 20. 2.31 -3.39 3.39 No <NA> #> 9 9. 55. -2.27 -3.33 3.33 No <NA> #> 10 10. 75. -2.06 -3.34 3.34 No <NA> #> 11 11. 54. 1.90 -3.30 3.30 No <NA> #> 12 12. 84. -1.93 -3.22 3.22 No <NA> #> 13 13. 58. 1.82 -3.01 3.01 No <NA> #> 14 14. 50. -1.88 -2.82 2.82 No <NA> #> 15 15. 32. 1.76 -2.74 2.74 No <NA> #> 16 16. 89. 1.73 -2.67 2.67 No <NA> #> 17 17. 43. -1.78 -2.60 2.60 No <NA> #> 18 18. 74. 1.65 -2.55 2.55 No <NA> #> 19 19. 52. -1.74 -2.53 2.53 No <NA> #> 20 20. 92. 1.43 -2.50 2.50 No <NA> #>