robLoc: Robust Estimate of Location

View source: R/robLoc.R

robLocR Documentation

Robust Estimate of Location

Description

Compute the robust estimate of location for very small samples.

Usage

robLoc(x, scale = NULL, na.rm = FALSE, maxit = 80L, tol = NULL,
       factors = c("AA", "CR"))

Arguments

x

numeric; A vector of values.

scale

numeric; The scale, if known, can be used to enhance the estimate for the location. Defaults to unknown.

na.rm

logical; If TRUE then NA values are stripped from x before computation takes place.

maxit

numeric; The maximum number of iterations. Defaults to 80.

tol

numeric; The desired numeric tolerance. Defaults to the square root of .Machine$double.eps or roughly 1.49\times 10^{-8}.

factors

character; "CR" will use the factors calculated in Croux & Rousseeuw (1992) while "AA" (default) will use the factors calculated by the package author.

Details

Computes the M-estimator for location using the logistic \psi function of Rousseeuw & Verboven (2002, 4.1). If there are three or fewer entries, the function defaults to the median.

If the scale is known and passed through scale, the algorithm uses the suggestion in Rousseeuw & Verboven section 5 (2002), substituting the known scale for the mad.

If na.rm is TRUE then NA values are stripped from x before computation takes place. If this is not done then an NA value in x will return an error.

The tolerance and number of iterations are similar to those in existing base R functions.

Rousseeuw & Verboven suggest using this function when there are 3–8 samples. It is implied that having more than 8 samples allows the use of more standard estimators.

Value

Solves for the robust estimate of location, T_n, which is the solution to

\frac{1}{n}\sum_{i = 1}^n\psi\left(\frac{x_i - T_n}{S_n}\right) = 0

where S_n is fixed at mad(x). The \psi-function selected by Rousseeuw & Verboven is:

\psi_{log}(x) = \frac{e^x - 1}{e^x + 1}

This is equivalent to 2 * plogis(x) - 1.

Author(s)

Avraham Adler Avraham.Adler@gmail.com

References

Croux, Christophe and Rousseeuw, Peter J. (1992) "Time-Efficient Algorithms for Two Highly Robust Estimators of Scale", Computational Statistics, Vol. 1, 411–428. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-3-662-26811-7_58")}

Rousseeuw, Peter J. and Verboven, Sabine (2002) Robust estimation in very small samples. Computational Statistics & Data Analysis, 40, (4), 741–758. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/S0167-9473(02)00078-6")}

See Also

median

Examples

robLoc(c(1:9))
x <- c(1,2,3,5,7,8)
robLoc(x)

revss documentation built on March 18, 2026, 9:06 a.m.