View source: R/biweight_scale.R
biweight_scale | R Documentation |
This function computes the biweight scale, a robust measure of scale or dispersion for a numeric vector. The biweight scale is less sensitive to outliers than the sample standard deviation.
biweight_scale(
x,
loc = stats::median(x),
c = 9,
reduced = FALSE,
tol = 1e-06,
max_iter = 50,
drop.na = FALSE
)
x |
A numeric vector. |
loc |
Initial guess for the location (default: median of |
c |
A numeric value specifying the tuning constant for the biweight estimator ( |
reduced |
A logical value specifying whether the sample size, n, should be reduced to the number of non-rejected values. If |
tol |
Convergence tolerance for the iterative computation (default: 1e-6). |
max_iter |
Maximum number of iterations (default: 50). |
drop.na |
A logical value indicating whether to remove missing values ( |
The biweight scale of x
.
Christian L. Goueguel
Mosteller, F., and Tukey, J. W. (1977). Data Analysis and Regression: A Second Course in Statistics. Addison-Wesley, pp. 203-209.
# Example 1: Compute biweight scale for a vector
x <- c(seq(1,100))
tibble::tibble(
sd = stats::sd(x),
mad = stats::mad(x),
biscale = biweight_scale(x)
)
# Example 2: Biweight scale is robust to outliers
x <- c(seq(1,99), 1e3) # An outlier at 1000
tibble::tibble(
sd = stats::sd(x),
mad = stats::mad(x),
biscale = biweight_scale(x)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.