View source: R/biweight_location.R
| biweight_location | R Documentation |
This function computes the biweight location, a robust measure of central tendency for a numeric vector. The biweight location is less sensitive to outliers than the sample mean.
biweight_location(
x,
loc = NULL,
c = 6,
tol = 1e-06,
max_iter = 50,
drop_na = FALSE,
drop.na = deprecated()
)
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 ( |
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 ( |
drop.na |
Starting from the initial location M (the median by default), the
biweight location is
\zeta = M + \frac{\sum_{|u_i|<1} (x_i - M)(1 - u_i^2)^2}{\sum_{|u_i|<1} (1 - u_i^2)^2},
\quad u_i = \frac{x_i - M}{c \cdot \mathrm{MAD}}
where MAD is the (unscaled) median absolute deviation. The estimate is
iterated, replacing M by \zeta, until the change is smaller
than tol or max_iter iterations are reached.
The biweight location 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.
Beers, T.C., Flynn, K., Gebhardt, K., (1990). Measures of location and scale for velocities in clusters of galaxies - A robust approach. The Astronomical Journal, 100:32-46.
data(forageLIBS)
# iron contents (mg/kg): a few samples are far above the others
fe <- forageLIBS$Fe[!is.na(forageLIBS$Fe)]
c(mean = mean(fe), median = stats::median(fe), biweight = biweight_location(fe))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.