Skip to contents

Smooths in the PROBABILITY argument, not in x. The sample quantile uses a single order statistic and therefore jumps as p crosses i/n; this averages neighbouring order statistics with kernel weights, which removes the jumps and reduces variance – and the tails, where a single order statistic is a poor estimate, are exactly where that matters.

Usage

morie_fauzi_kernel_quantile(x, p, h = NULL)

Arguments

x

numeric sample.

p

probability levels strictly in (0, 1).

h

bandwidth on the probability scale; n^{-2/5} if NULL.

Value

list: p, quantile, sample_quantile, bandwidth, weights_sum, smooths_in, why, n, method.

Details

The weight on the i-th order statistic is the kernel mass of ((i-1)/n, i/n], computed as an exact difference of the integrated kernel rather than by quadrature.

Not to be confused with morie_kernel_quantile(), which is Horowitz's conditional quantile regression.

References

Fauzi and Maesono (2023), Eq. (3.1). From the PDF.

Examples

set.seed(1)
morie_fauzi_kernel_quantile(stats::rexp(200), c(0.25, 0.5))$quantile
#> [1] 0.3747570 0.8034854