Skip to content

Instantly share code, notes, and snippets.

@BrianWeinstein
Created January 29, 2019 17:05
Show Gist options
  • Save BrianWeinstein/c121f2276bddc9833b0cac4251acf635 to your computer and use it in GitHub Desktop.
Save BrianWeinstein/c121f2276bddc9833b0cac4251acf635 to your computer and use it in GitHub Desktop.
is_outlier <- function(x) {
# Computes a bootstrapped confidence interval
# INPUT:
# x: a numeric vector
# OUTPUT:
# a boolean vector, indicating if each value in x is an outlier
return(x < quantile(x, 0.25) - 1.5 * IQR(x) | x > quantile(x, 0.75) + 1.5 * IQR(x))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment