Skip to contents

The RIF of the \(\tau\)-quantile at a point \(q\) with density \(f\) is \(q + (\tau - 1\{y \le q\})/f\); its weighted mean is \(q + (\tau - F(q))/f\) (Research.P15.RIF.rif_quantile_avg) and equals \(q\) exactly when \(F(q) = \tau\) (rif_quantile_avg_eq_iff). The gap between two groups' RIF means is the quantile gap plus the two recentering terms (rif_gap).

Usage

morie_rif_quantile(y, tau, weights = NULL, q = NULL, f = NULL)

morie_rif_gap(yA, yB, tau, wA = NULL, wB = NULL)

Arguments

y

Outcomes.

tau

Quantile level in (0, 1).

weights

Optional non-negative weights.

q

Evaluation point; the weighted \(\tau\)-quantile by default.

f

Density value at q; a kernel estimate by default.

yA, yB

Outcomes of the two groups.

wA, wB

Their optional weights.

Value

A list with rif (one value per outcome), q, f, F_q (weighted share at or below q), mean_rif and recentering (\((\tau - F(q))/f\), zero at the sample quantile).

For morie_rif_gap: a list with the two groups' RIF results, gap (difference of RIF means), quantile_gap and recentering_gap, with gap = quantile_gap + recentering_gap.

Examples

set.seed(4)
r <- morie_rif_quantile(rexp(300), 0.5)
c(r$q, r$mean_rif)
#> [1] 0.7348583 0.7348583
set.seed(5)
morie_rif_gap(rexp(200, 1), rexp(200, 0.7), 0.5)$gap
#> [1] -0.2593112