View source: R/mad_remove_outliers.R
mad_remove_outliers | R Documentation |
Detect outliers in a numeric vector using the Median Absolute Deviation (MAD) method and remove or convert them. For more information on MAD, see Leys et al. (2013) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jesp.2013.03.013")}
mad_remove_outliers(
x = NULL,
threshold = 2.5,
constant = 1.4826,
convert_outliers_to = NA,
output_type = "converted_vector"
)
x |
a numeric vector |
threshold |
the threshold value for determining outliers.
If |
constant |
scale factor for the 'mad' function in the 'stats'
package. It is the constant linked to the assumed distribution.
In case of normality, constant = 1.4826.
By default, |
convert_outliers_to |
the value to which outliers will be converted.
For example, if |
output_type |
type of the output.
If |
## Not run:
mad_remove_outliers(x = c(1, 3, 3, 6, 8, 10, 10, 1000))
mad_remove_outliers(x = c(1, 3, 3, 6, 8, 10, 10, 1000, -10000))
# return the vector with the outlier converted to NA values
mad_remove_outliers(
x = c(1, 3, 3, 6, 8, 10, 10, 1000, -10000),
output_type = "converted_vector")
# return the cutoff values for determining outliers
mad_remove_outliers(
x = c(1, 3, 3, 6, 8, 10, 10, 1000, -10000),
output_type = "cutoff_values")
# return the outliers
mad_remove_outliers(
x = c(1, 3, 3, 6, 8, 10, 10, 1000, -10000),
output_type = "outliers")
mad_remove_outliers(
x = c(1, 3, 3, 6, 8, 10, 10, 1000, -10000),
output_type = "non_outlier_values")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.