Learn R Programming

robsurvey (version 0.1.0)

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

Description

weighted_mad computes weighted median absolute deviation from the weighted median

Usage

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)

Value

Weighted median absolute deviation from the (weighted) median

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.

See Also

weighted_median

Examples

Run this code
# NOT RUN {
x <- c(0.1, 0.35, 0.05, 0.1, 0.15, 0.05, 0.2)
weighted_mad(x, x)
# }

Run the code above in your browser using DataLab