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 = stats::median(x),
c = 6,
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 ( |
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 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.
# Example 1: Compute biweight location for a vector
x <- c(seq(1,100))
tibble::tibble(
mean = mean(x),
med = stats::median(x),
biloc = biweight_location(x)
)
# Example 2: Biweight location is robust to outliers
x <- c(seq(1,99), 1e3) # An outlier at 1000
tibble::tibble(
mean = mean(x),
med = stats::median(x),
biloc = biweight_location(x)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.