Skip to contents

Internal core of weighted_quantiles: the midpoint-position interpolation, assuming inputs are already filtered (finite values, positive weights) and sorted ascending by value with weights aligned. Exposed so hot callers that sort once and reuse the order across many subsets (e.g. optimize_ensemble_subset) can skip the per-call order().

Usage

weighted_quantiles_presorted(x_sorted, w_sorted, probs)

Arguments

x_sorted

Numeric vector of values, sorted ascending, all finite.

w_sorted

Numeric vector of weights aligned with x_sorted, all finite and positive.

probs

Numeric vector of quantile probabilities (between 0 and 1).

Value

Vector of weighted quantiles, one per element of probs.