adm {revss}R Documentation

Average Distance to the Median

Description

Compute the mean absolute deviation from the median, and (by default) adjust by a factor for asymptotically normal consistency.

Usage

adm(x, center = median(x), constant = sqrt(pi / 2), na.rm = FALSE)

Arguments

x

A numeric vector.

center

The central value from which to measure the average distance. Defaults to the median.

constant

A scale factor for asymptotic normality defaulting to \sqrt{\frac{\pi}{2}}.

na.rm

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

Details

Computes the average distance, as an absolute value, between each observation and the central observation—usually the median. In statistical literature this is also called the mean absolute deviation around the median. Unfortunately, this shares the same acronym as the median absolute deviation (MAD), which is the median equivalent of this function.

General practice is to adjust the factor for asymptotically normal consistency. In large samples this approaches \sqrt{\frac{2}{\pi}}. The default is to multiple the results by the reciprocal. However, it is important to note that this asymptotic behavior may not hold with the smaller sample sizes for which this package is intended.

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.

Value

ADM = C\frac{1}{n}\sum_{i=1}^n{|x_i - \textrm{center}(x)|}

where C is the consistency constant and center defaults to median.

Author(s)

Avraham Adler Avraham.Adler@gmail.com

References

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

See Also

mad for the median absolute deviation from the median

Examples

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

[Package revss version 2.0.0 Index]