The function is based on a weighted version
of the quickselect/Find algorithm with the Bentley and McIlroy
(1993) 3-way partitioning scheme. For very small arrays,
we use insertion sort.
Compatibility.
For equal weighting, i.e., when all elements in
w are equal, weighted_quantile is identical with
type = 2 of stats::quantile; see also
Hyndman and Fan (1996).
References
Bentley, J. L. and McIlroy, D. M. (1993). Engineering a Sort Function,
Software - Practice and Experience23, 1249--1265.
tools:::Rd_expr_doi("10.1002/spe.4380231105")
Hyndman, R.J. and Fan, Y. (1996). Sample Quantiles in Statistical Packages,
The American Statistician50, 361--365.
tools:::Rd_expr_doi("10.1080/00031305.1996.10473566")