adm: Average Distance to the Median

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/adm.R

Description

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

Usage

1
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. In large samples, the adm asymptotically approaches \code{sqrt(2 / pi)} times the sample standard deviation.

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.

The default is to adjust the factor for asymptotically normal consistency. In large samples this approaches \code{sqrt(2 / pi)}, which is the default. This 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 * mean(sum(abs(x - median(x))))

where C is the consistency constant.

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

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

revss documentation built on Jan. 8, 2021, 2:39 a.m.