weighted_IQR: Weighted Interquartile Range (IQR)

View source: R/weighted_IQR.R

weighted_IQRR Documentation

Weighted Interquartile Range (IQR)

Description

Weighted (normalized) interquartile range

Usage

weighted_IQR(x, w, na.rm = FALSE, constant = 0.7413)

Arguments

x

[numeric vector] data.

w

[numeric vector] weights (same length as x).

na.rm

[logical] indicating whether NA values should be removed before the computation proceeds (default: FALSE).

constant

[double] constant scaling factor to make the weighted IQR a consistent estimator of the scale (default: 0.7413).

Details

By default, the weighted IQR is normalized to be an unbiased estimate of scale at the Gaussian core model. If normalization is not wanted, put constant = 1.

Value

Weighted IQR

See Also

Overview (of all implemented functions)

Examples

data(workplace)

# normalized weighted IQR (default)
weighted_IQR(workplace$employment, workplace$weight)

# weighted IQR (without normalization)
weighted_IQR(workplace$employment, workplace$weight, constant = 1)

robsurvey documentation built on Jan. 6, 2023, 5:09 p.m.