weighted_IQR function

Weighted Interquartile Range (IQR)

Weighted Interquartile Range (IQR)

Weighted (normalized) interquartile range

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.

Returns

Weighted IQR

See Also

Overview (of all implemented functions)

Examples

head(workplace) # normalized weighted IQR (default) weighted_IQR(workplace$employment, workplace$weight) # weighted IQR (without normalization) weighted_IQR(workplace$employment, workplace$weight, constant = 1)
  • Maintainer: Tobias Schoch
  • License: GPL (>= 2)
  • Last published: 2024-08-22