weighted_mad: Weighted median absolute deviation from the median (MAD)

Description Usage Arguments Details Value See Also Examples

View source: R/robsurvey.R

Description

weighted_mad computes weighted median absolute deviation from the weighted median

Usage

1
weighted_mad(x, w, na.rm = FALSE, constant = 1.4826)

Arguments

x

a numeric vector

w

a numeric vector of weights

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

constant

(scale factor, default: 1.4826)

Details

The weighted MAD is computed as the (normalized) weighted median of the absolute deviation from the weighted median; the median is computed as the weighted lower sample median (see weighted_median); the MAD is normalized to be an unbiased estimate of scale at the Gaussian core model.

Value

Weighted median absolute deviation from the (weighted) median

See Also

weighted_median

Examples

1
2
x <- c(0.1, 0.35, 0.05, 0.1, 0.15, 0.05, 0.2)
weighted_mad(x, x)

martinSter/robsurvey documentation built on Oct. 11, 2019, 4:45 p.m.