wquant: Weighted quantile function

wquantR Documentation

Weighted quantile function

Description

Estimate weighted quantiles.

Usage

wquant(
  x,
  weights = rep(1, length(x)),
  probs = c(`0%` = 0, `25%` = 0.25, `50%` = 0.5, `75%` = 0.75, `100%` = 1)
)

Arguments

x

numeric; a vector of data.

weights

numeric; vector of weights.

probs

numeric; desired quantiles.

Details

wquant estimates quantiles of weighted data using the estimator of Harrell & Davis (1982), with improvements recommended by Andrey Akinshin (2023).

Value

wquant returns a vector containing the estimated quantiles. If probs has names, these are inherited.

Author(s)

Aaron A. King

References

\Harrell

1982

\Akinshin

2023

Examples

x <- c(1,1,1,2,2,3,3,3,3,4,5,5,6,6,6)
quantile(x)
wquant(x)
wquant(c(1,2,3,4,5,6),weights=c(3,2,4,1,2,3))
wquant(c(1,2,3,4,5),c(1,0,0,1,1))

kingaa/pomp documentation built on April 24, 2024, 11:25 a.m.