dot-weighted_quantile: Weighted generalized-inverse (step-function) quantile

.weighted_quantileR Documentation

Weighted generalized-inverse (step-function) quantile

Description

⁠q_hat(u) = inf{y : F_w(y) >= u}⁠ for the weighted empirical CDF F_w, the natural SBW-weighted analogue of stats::quantile(type = 1).

Usage

.weighted_quantile(y, w, probs)

Arguments

y

Numeric outcome vector for one arm.

w

Nonnegative weights, same length as y.

probs

Vector of probabilities in (0, 1).

Details

Normalizes by sum(w), not length(y). By construction (the balancing QP's intercept equality constraint), SBW weights for an arm sum to that arm's size – but only up to solver precision, since the nonneg-QP fallback's clipping of negative numerical dust can nudge the sum a hair away from it. Dividing by sum(w) keeps F_w a valid CDF (F_w(Inf) = 1 exactly) regardless, and avoids having to track which arm's size applies to whatever w subset was passed in.

Value

Numeric vector of estimated quantiles, one per element of probs.


sbwadjust documentation built on Oct. 10, 2026, 5:08 p.m.