Order-Statistics Confidence Intervals for Quantiles
ci_order_statistics.RdDistribution-free confidence intervals for population quantiles using
order statistics. Uses the Beta distribution to find order-statistic
indices j,k such that (X_(j), X_(k)) covers the p-th quantile with
at least the specified confidence level.
Value
A data.frame with columns: probability, quantile, lower,
upper, j, k, actual_coverage, method.
Details
For a sample of size n, the probability that the interval (X_(j), X_(k))
contains the p-th quantile is pbeta(p, j, n-j+1) - pbeta(p, k, n-k+1).
We search for the tightest such interval achieving at least conf_level
coverage.
This method is distribution-free: it requires no parametric assumptions. With ~8 years of hourly data (~70k observations), order-statistic CIs are well-defined even for extreme quantiles like the 99th percentile.