Description Usage Arguments Details Examples
View source: R/augmented_median.R
Offering a continuous link between median and arithmetic mean
1 | aug_median(x, p = 1, rank = FALSE, na.rm = FALSE)
|
x |
numeric vector |
p |
positive numeric narrowness of the weight. |
rank |
logical. Should should ranks or numeric values determine relative weights? |
na.rm |
logical. Should missing values be removed? |
A weighted arithmetic mean is calculated over the input vector, where
most weight is given to the median value(s), and monotonically less towards either
extreme. Faloff depends on p, with small values resulting in a gentler
falloff and less difference between minimum and maximum weights.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | x <- c(0, 8, 8, 8, 9)
aug_median(x)
# 0 and 9 are considered equidistant from 8
aug_median(x, rank=TRUE)
# Nearly a point weight placed at the median
aug_median(x, 100)
median(x)
# Nearly uniform weights
aug_median(x, 0.001)
mean(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.