robScale: Robust Estimate of Scale

View source: R/robScale.R

robScaleR Documentation

Robust Estimate of Scale

Description

Compute the robust estimate of scale for very small samples.

Usage

robScale(x, loc = NULL, implbound = 1e-4, na.rm = FALSE, maxit = 80L,
         tol = sqrt(.Machine$double.eps))

Arguments

x

A numeric vector.

loc

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

implbound

The smallest value that mad is allowed before being considered too close to 0.

na.rm

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

maxit

The maximum number of iterations; defaults to 80.

tol

The desired accuracy.

Details

Computes the M-estimator for scale using a smooth ρ-function defined as the square of the logistic ψ function used in location estimation (Rousseeuw & Verboven, 2002, 4.2). When the sequence of observations is too short for a robust estimate, the scale estimate will default to mad so long as mad has not “imploded”, i.e. it is greater than implbound which defaults to 0.0001. When mad has imploded, adm is used instead.

If the location is known and passed through loc, the algorithm uses the suggestion in Rousseeuw & Verboven section 5 (2002) converting the observations to distances from 0 and iterating on the adjusted sequence.

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 cause mad to return NA.

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 scale, Sn, which is the solution to

mean(ρ((xi - Tn)/Sn)) = β

where Tn is fixed at median(x) and β is fixed at 0.5. The ρ-function selected by Rousseeuw & Verboven is based on the square of the ψ-function used in robLoc. Specifically

ρ(x) = ψ^2(x / 0.3739)

The 0.3739 is needed for β to be 0.5.

Author(s)

Avraham Adler Avraham.Adler@gmail.com

References

Rousseeuw, Peter J. and Verboven, Sabine (2002) Robust estimation in very small samples. Computational Statistics & Data Analysis, 40, (4), 741–758. doi: 10.1016/S0167-9473(02)00078-6

See Also

adm and mad as basic robust estimators of scale.

Qn and Sn in the robustbase package which are specialized robust scale estimators for larger samples. The latter two are based on code written by Peter Rousseeuw.

Examples

robScale(c(1:9))
x <- c(1,2,3,5,7,8)
c(robScale(x), robScale(x, loc = 5))

revss documentation built on Feb. 16, 2023, 5:17 p.m.