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.
Arguments
- x
A numeric vector.
- loc
Initial guess for the location (default: median of
x).- c
A numeric value specifying the tuning constant for the biweight estimator (
c = 6by default).- 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 (
NA) from the calculations. IfTRUE, missing values will be removed. IfFALSE(the default), the result isNAwhenxcontains missing values.
Details
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.
References
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.
