adm | R Documentation |
Compute the mean absolute deviation from the median, and (by default) adjust by a factor for asymptotically normal consistency.
adm(x, center = median(x), constant = sqrt(pi / 2), na.rm = FALSE)
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
|
na.rm |
If |
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
.
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
.
Avraham Adler Avraham.Adler@gmail.com
Nair, K. R. (1947) A Note on the Mean Deviation from the Median. Biometrika, 34, 3/4, 360–362. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2332448")}
mad
for the median absolute deviation from the
median
adm(c(1:9))
x <- c(1,2,3,5,7,8)
c(adm(x), adm(x, constant = 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.