Learn R Programming

robscale (version 0.1.1)

adm: Average Distance to the Median

Description

Compute the mean absolute deviation from the median, scaled by a consistency constant for asymptotic normality under the Gaussian model.

Usage

adm(x, center, constant = 1.2533141373155, na.rm = FALSE)

Value

A single numeric value: the scaled mean absolute deviation from the center. Returns NA if x has length zero after removal of

NAs.

Arguments

x

A numeric vector.

center

Optional numeric scalar giving the central value from which to measure the average absolute distance. Defaults to the median of x.

constant

Consistency constant for asymptotic normality at the Gaussian. Defaults to \(\sqrt{\pi/2} \approx 1.2533\) (Nair, 1947). Set to 1 for the raw (unscaled) mean absolute deviation.

na.rm

Logical. If TRUE, NA values are stripped from x before computation. If FALSE (the default), the presence of any NA raises an error.

Details

The average distance to the median (ADM) is defined as

$$\mathrm{ADM}(x) \;=\; C \cdot \frac{1}{n}\sum_{i=1}^{n} |x_i - \mathrm{med}(x)|$$

where \(C\) is the consistency constant and \(\mathrm{med}(x)\) is the sample median. When center is supplied it replaces the median.

The default constant \(C = \sqrt{\pi/2}\) makes the ADM a consistent estimator of the standard deviation under the normal distribution. In large samples the ADM converges to \(\sigma\) at the Gaussian; however, this asymptotic property may not hold at the very small sample sizes (\(n = 3\)--\(8\)) for which this package is primarily intended.

The ADM is not robust against outliers in the explosion sense: its explosion breakdown point is \(1/n\). However, it is highly resistant to implosion, with an implosion breakdown point of \((n-1)/n\). It therefore serves as the fallback scale estimator in robScale when the MAD collapses to zero.

References

Nair, K. R. (1947) A Note on the Mean Deviation from the Median. Biometrika, 34(3/4), 360--362. tools:::Rd_expr_doi("10.2307/2332448")

Rousseeuw, P. J. and Verboven, S. (2002) Robust estimation in very small samples. Computational Statistics & Data Analysis, 40(4), 741--758. tools:::Rd_expr_doi("10.1016/S0167-9473(02)00078-6")

See Also

mad for the median absolute deviation from the median; robScale for the M-estimator of scale that uses the ADM as an implosion fallback.

Examples

Run this code
adm(c(1:9))

x <- c(1, 2, 3, 5, 7, 8)
adm(x)                      # with consistency constant
adm(x, constant = 1)        # raw mean absolute deviation

# Supply a known center
adm(x, center = 4.0)

Run the code above in your browser using DataLab