<p><span>\[
\newcommand{\bm}[1]{\boldsymbol{\mathbf{#1}}}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\]</span></p>
<h2>Abstract</h2>
<p>We discuss the computation of confidence intervals for the median or any other quantile in R. In particular we are interested in the interpolated order statistic approach suggested by <span>Hettmansperger and Sheather (1986)</span> and <span>Nyblom (1992)</span>. In order to make the methods available to a greater audience we provide an implementation of these methods in the R package <code>quantileCI</code> and a small simulation study is conducted to show that these intervals indeed have a very good coverage. The study also shows that these intervals perform better than the currently available approaches in R. We therefore propose that these intervals should be used more in the future!</p>
<p><br><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"></a> This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>. The markdown+Rknitr source code of this blog is available under a <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU General Public License (GPL v3)</a> license from <a href="https://github.com/hoehleatsu/hoehleatsu.github.io"></a>.</p>
<h2>Introduction</h2>
<p>Statistics 101 teaches that for a distribution, possibly contaminated with outliers, a robust measure of the central tendency is the median. Not knowing this fact can make your analysis worthy to report in the <a href="http://www.sueddeutsche.de/wirtschaft/heilbronn-dieser-mann-ist-so-reich-dass-statistiken-seines-wohnorts-wertlos-sind-1.2705044">newspaper</a> (<a href="https://translate.google.com/translate?sl=de&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fwww.sueddeutsche.de%2Fwirtschaft%2Fheilbronn-dieser-mann-ist-so-reich-dass-statistiken-seines-wohnorts-wertlos-sind-1.2705044&edit-text=">Google translate</a>).</p>
<p>Higher quantiles of a distribution also have a long history as threshold for when to declare an observation an outlier. For example, growth curves for children illustrate how the quantiles of, e.g., <a href="http://www.cdc.gov/growthcharts/data/set1clinical/cj41l024.pdf">the BMI distribution develop by age</a>. <strong>Obesity</strong> is then for children defined as exceedance of the <a href="http://www.who.int/growthref/bmifa_girls_z_5_19_labels.pdf?ua=1">97.7% quantile</a> of the distribution at a particular age. Quantile regression is a non-parametric method to compute such curves and the statistical community has been quite busy lately investigating new ways to compute such quantile regressions models.</p>
<p>The focus of this blog post is nevertheless the simplest setting: Given an iid. sample <span>\(\bm{x}\)</span> of size <span>\(n\)</span> from a univariate and absolutely continuous distribution <span>\(F\)</span>, how does one compute an estimate for the <span>\(p\)</span>-Quantile of <span>\(F\)</span> together with a corresponding two-sided <span>\((1-\alpha)\cdot 100\%\)</span> confidence interval for it?</p>
<h3>The Point Estimate</h3>
<p>Computing the quantile in a sample with statistical software is discussed in the excellent survey of <span>Hyndman and Fan (1996)</span>. The simplest estimator is based on the <a href="https://en.wikipedia.org/wiki/Order_statistic">order statistic</a> of the sample, i.e. <span>\(x_{(1)} &lt; x_{(2)} &lt; \cdots &lt; x_{(n)}\)</span>. <span>\[
\hat{x}_p = \min_{k} \left\{\hat{F}(x_{(k)}) \geq p\right\} = x_{(\lceil n \cdot p\rceil)},
\]</span> where <span>\(\hat{F}\)</span> is the <a href="https://en.wikipedia.org/wiki/Empirical_distribution_function">empirical cumulative distribution</a> function of the sample. Since <span>\(\hat{F}\)</span> has jumps of size <span>\(1/n\)</span> the actual value of <span>\(\hat{F}(\hat{x}_{p})\)</span> can end up being somewhat larger than the desired <span>\(p\)</span>. Therefore, <span>Hyndman and Fan (1996)</span> prefer estimators interpolating between the two values of the order statistic with <span>\(\hat{F}\)</span> just below and just above <span>\(p\)</span>. It is interesting that even <a href="http://robjhyndman.com/hyndsight/sample-quantiles-20-years-later/">20 years after</a>, there still is no universally accepted way to do this in different statistical software and the <code>type</code> argument of the <code>quantile</code> function in R has been a close friend when comparing results with SPSS or Stata users. In what follows we will, however, stick with the simple <span>\(x_{(\lceil n \cdot p\rceil)}\)</span> estimator stated above.</p>
<p>Below is illustrated how one would use R to compute the, say, the 80% quantile of a sample using the above estimator. We can compute this either manually or using the <code>quantile</code> function with <code>type=1</code>:</p>
<div><pre><code>##Make a tiny artificial dataset, say, the BMI z-score of 25 children
<span>sort</span>(x &lt;-<span> </span><span>rnorm</span>(<span>25</span>))</code></pre></div>
<pre><code>##  [1] -1.44090165 -1.40318433 -1.21953433 -0.95029549 -0.90398754 -0.66095890 -0.47801787
##  [8] -0.43976149 -0.36174823 -0.34116984 -0.33047704 -0.31576897 -0.28904542 -0.03789851
## [15] -0.03764990 -0.03377687  0.22121130  0.30331291  0.43716773  0.47435054  0.60897987
## [22]  0.64611097  1.20086374  1.52483138  2.67862782</code></pre>
<div><pre><code>##Define the quantile we want to consider
p &lt;-<span> </span><span>0.8</span>
##Since we know the true distribution we can easily find the true quantile
(x_p &lt;-<span> </span><span>qnorm</span>(p))</code></pre></div>
<pre><code>## [1] 0.8416212</code></pre>
<div><pre><code>##Compute the estimates using the quantile function and manually
<span>c</span>(<span>quantile=</span><span>quantile</span>(x, <span>type=</span><span>1</span>, <span>prob=</span>p), <span>manual=</span><span>sort</span>(x)[<span>ceiling</span>(<span>length</span>(x)*p)])</code></pre></div>
<pre><code>## quantile.80%       manual 
##    0.4743505    0.4743505</code></pre>
<h3>Confidence interval for the quantile</h3>
<p>Besides the point estimate <span>\(\hat{x}_p\)</span> we also would like to report a two-sided <span>\((1-\alpha)\cdot 100\%\)</span> confidence interval <span>\((x_p^{\text{l}}, x_p^{\text{u}})\)</span> for the desired population quantile. The interval <span>\((x_p^{\text{l}}, x_p^{\text{u}})\)</span> should, hence, fulfill the following condition: <span>\[
P( (x_p^{\text{l}}, x_p^{\text{u}}) \ni x_p) = 1 - \alpha,
\]</span> where we have used the &quot;backwards&quot; <span>\(\in\)</span> to stress the fact that it's the interval which is random. Restricting the limits of this confidence intervals to be <strong>one of the realisations from the order statistics</strong> implies that we need to find indices <span>\(d\)</span> and <span>\(e\)</span> with <span>\(d&lt;e\)</span> s.t. <span>\[
P( x_{(d)} \leq x_p \leq x_{(e)}) \geq 1 - \alpha.
\]</span> Note that it may not be possible to achieve the desired coverage exactly in this case. For now we prefer the conservative choice of having to attain <strong>at least</strong> the desired coverage. Note that for <span>\(1\leq r \leq n\)</span> we have <span>\[
\begin{align*}
P( x_{r} \leq x_p) &amp;= P(\text{at least $r$ observations are smaller than or equal to $x_p$}) \\
&amp;= \sum_{k=r}^{n} P(\text{exactly $k$ observations are smaller than or equal to $x_p$}) \\
&amp;= \sum_{k=r}^{n} {n \choose k} P(X \leq x_p)^k (1-P(X \leq x_p))^{n-k} \\
&amp;= \sum_{k=r}^{n} {n \choose k} p^k (1-p)^{n-k} \\
&amp;= 1 - \sum_{k=0}^{r-1} {n \choose k} p^k (1-p)^{n-k}
\end{align*}
\]</span> In principle, we could now try out all possible <span>\((d,e)\)</span> combinations and for each interval investigate, whether it has the desired <span>\(\geq 1-\alpha/2\)</span> property. If several combinations achieve this criterion we would, e.g., take the interval having minimal length. This is what the <code>MKmisc::quantileCI</code> function does. However, the number of pairs to investigate is of order <span>\(O(n^2)\)</span>, which for large <span>\(n\)</span> quickly becomes lengthy to compute. Instead, we compute an <strong>equi-tailed confidence interval</strong> by finding two one-sided <span>\(1-\alpha/2\)</span> intervals, i.e. we find <span>\(d\)</span> and <span>\(e\)</span> s.t. <span>\(P(x_{(d)} \leq x_p) = 1-\alpha/2\)</span> and <span>\(P(x_p \geq x_{(e)}) = 1-\alpha/2\)</span>. In other words,</p>
<p><span>\[
\begin{align*}
d &amp;= \argmax P(x_{(r)} \leq x_p) \geq 1 - \frac{\alpha}{2} \\
&amp;= \texttt{qbinom(alpha/2, size=n, prob=p)} \\
e &amp;= \argmin P(x_p \geq x_{(r)}) \geq 1 - \frac{\alpha}{2} \\
&amp;= \texttt{qbinom(1-alpha/2, size=n, prob=p) + 1}
\end{align*}
\]</span></p>
<p>Note that the problem can arise, that the above solutions are zero or <span>\(n+1\)</span>, respectively. In this case one has to decide how to proceed. For an illustration of the above in case of the median see the <a href="http://freakonometrics.hypotheses.org/4199">post</a> by <a href="https://twitter.com/freakonometrics">@freakonometrics</a>. Also note that the <code>qbinom</code> function uses the <a href="https://en.wikipedia.org/wiki/Cornish%E2%80%93Fisher_expansion">Cornish-Fisher Expansion</a> to come up with an initial guess for the quantile, which is then refined by a numerical search. In other words, the function is of order <span>\(O(1)\)</span> and will, hence, be fast even for large <span>\(n\)</span>.</p>
<p>When it comes to confidence intervals for quantiles the set of alternative implementations in R is extensive. <a href="http://finzi.psych.upenn.edu/cgi-bin/namazu.cgi?query=confidence+interval+for+quantiles&max=100&result=normal&sort=score&idxname=functions&idxname=vignettes&idxname=views">Searching for this on CRAN</a>, we found the following functionality:</p>
<table><tr>Package::Function
Version
Description
</tr><tr><td><a href="http://finzi.psych.upenn.edu/R/library/MKmisc/html/quantileCI.html"><code>MKMisc::quantileCI</code></a></td>
<td>0.993</td>
<td>Implements an exact but very slow <span>\(O(n^2)\)</span> search as well as an asymptotic method approximating the exact procedure. Do to the method being slow it is not investigated further, but looking at it an <code>Rcpp</code> implementation of the nested loop might be able to speed up the performance substantially.</td>
</tr><tr><td></td>
<td></td>
<td></td>
</tr><tr><td><a href="http://finzi.psych.upenn.edu/R/library/jmuOutlier/html/quantileCI.html"><code>jmuOutlier::quantileCI</code></a></td>
<td>1.1</td>
<td>Implements the exact method.</td>
</tr><tr><td></td>
<td></td>
<td></td>
</tr><tr><td><a href="http://finzi.psych.upenn.edu/R/library/EnvStats/html/eqnpar.html"><code>envStats::eqnpar</code></a></td>
<td>2.1.1</td>
<td>implements both an exact and an asymptotic interval</td>
</tr><tr><td></td>
<td></td>
<td></td>
</tr><tr><td><a href="http://finzi.psych.upenn.edu/R/library/asht/html/quantileTest.html"><code>asht::quantileTest</code></a></td>
<td>0.6</td>
<td>also implements an exact method</td>
</tr><tr><td></td>
<td></td>
<td></td>
</tr><tr><td><a href="http://finzi.psych.upenn.edu/R/library/Qtools/html/confint.midquantile.html"><code>Qtools::confint.midquantile</code></a></td>
<td>1.1</td>
<td>operates on the mid-quantile (whatever that is). The method is not investigated further.</td>
</tr><tr><td></td>
<td></td>
<td></td>
</tr></table><p>
</p><p>There might even be more, but for now we are satisfied comparing just the above mentioned procedures:</p>
<div><pre><code><span>as.numeric</span>(MKmisc::<span>quantileCI</span>(<span>x=</span>x, <span>prob=</span>p, <span>method=</span><span>&quot;exact&quot;</span>,<span>conf.level=</span><span>0.95</span>)$CI)
<span>as.numeric</span>(MKmisc::<span>quantileCI</span>(<span>x=</span>x, <span>prob=</span>p, <span>method=</span><span>&quot;asymptotic&quot;</span>,<span>conf.level=</span><span>0.95</span>)$CI)
<span>as.numeric</span>(jmuOutlier::<span>quantileCI</span>(<span>x=</span>x, <span>probs=</span>p, <span>conf.level=</span><span>0.95</span>)[<span>1</span>,<span>c</span>(<span>&quot;lower&quot;</span>,<span>&quot;upper&quot;</span>)])
<span>as.numeric</span>(EnvStats::<span>eqnpar</span>(<span>x=</span>x, <span>p=</span>p, <span>ci=</span><span>TRUE</span>, <span>ci.method=</span><span>&quot;exact&quot;</span>,<span>approx.conf.level=</span><span>0.95</span>)$interval$limits)
<span>as.numeric</span>(EnvStats::<span>eqnpar</span>(<span>x=</span>x, <span>p=</span>p, <span>ci=</span><span>TRUE</span>, <span>ci.method=</span><span>&quot;normal.approx&quot;</span>,<span>approx.conf.level=</span><span>0.95</span>)$interval$limits)
<span>as.numeric</span>(asht::<span>quantileTest</span>(<span>x=</span>x,<span>p=</span>p,<span>conf.level=</span><span>0.95</span>)$conf.int)</code></pre></div>
<pre><code>## [1] -0.03377687  1.52483138
## [1] -0.03377687  1.52483138
## [1] -0.03377687  1.52483138
## [1] 0.2212113 2.6786278
## [1] -0.03377687  1.52483138
## [1] -0.03377687  2.67862782</code></pre>
<p>An impressive number of similar, but yet, different results! To add to the confusion here is our take at this as developed in the <code>quantileCI</code> package available from github:</p>
<div><pre><code>devtools::<span>install_github</span>(<span>&quot;hoehleatsu/quantileCI&quot;</span>)</code></pre></div>
<p>The package provides three methods for computing confidence intervals for quantiles:</p>
<div><pre><code>quantileCI::<span>quantile_confint_nyblom</span>(<span>x=</span>x, <span>p=</span>p, <span>conf.level=</span><span>0.95</span>,<span>interpolate=</span><span>FALSE</span>)
quantileCI::<span>quantile_confint_nyblom</span>(<span>x=</span>x, <span>p=</span>p, <span>conf.level=</span><span>0.95</span>,<span>interpolate=</span><span>TRUE</span>)
quantileCI::<span>quantile_confint_boot</span>(x, <span>p=</span>p, <span>conf.level=</span><span>0.95</span>,<span>R=</span><span>999</span>, <span>type=</span><span>1</span>)</code></pre></div>
<pre><code>## [1] -0.03377687  2.67862782
## [1] 0.07894831 1.54608644
## [1] -0.0376499  1.2008637</code></pre>
<p>The first procedure with <code>interpolate=FALSE</code> implements the previously explained exact approach, which is also implemented in some of the other packages. However, when the <code>interpolate</code> argument is set to <code>TRUE</code> (the default), an additional interpolation step between the two neighbouring order statistics is performed as suggested in the work of <span>Nyblom (1992)</span>, which extends work for the median by <span>Hettmansperger and Sheather (1986)</span> and generates intervals of the form.</p>
<p><span>\[
\left( (1-\lambda_1) x_{(d)} + \lambda_1 x_{(d+1)}, (1-\lambda_2) x_{(e-1)} + \lambda_1 x_{(e)} \right)
\]</span></p>
<p>with <span>\(0 \leq \lambda_1, \lambda_2 \leq 1\)</span> chosen appropriately to get as close to the desired coverage as possible without knowing the exact underlying distribution - see the paper for details.</p>
<p>The last call in the above is to a basic bootstrap procedure, which resamples the data with replacement, computes the quantile using <code>type=1</code> and then reports the 2.5% and 97.5% percentiles of this bootstrapped distribution. Such percentiles of the basic bootstrap are a popular way to get confidence intervals for the quantile, e.g., this is what we have used in <span>Höhle and Höhle (2009)</span> for reporting the 95% quantile of the absolute difference in height at so called <strong>check points</strong> in the assessment of accuracy for a digital elevation model (DEM) in photogrammetry. However, the coverage of the percentile bootstrap procedure is not without problems, because the convergence rate as a function of the number of replicates <span>\(r\)</span> is only of order <span>\(O(r^{-\frac{1}{2}})\)</span> for quantiles (<span>Falk and Kaufmann (1991)</span>). As a trade-off between accuracy and speed we use <span>\(R=999\)</span> throughout this post.</p>
<h2>Simulation Study to Determine Coverage</h2>
<p>We write a function, which for a given sample <code>x</code> computes two-sided confidence intervals for the p-Quantile using a selection of the above described procedures:</p>
<div><pre><code><span>quantile_confints</span>(x, <span>p=</span>p, <span>conf.level=</span><span>0.95</span>)</code></pre></div>
<pre><code>##   jmuOutlier_exact EnvStats_exact EnvStats_asymp asht_quantTest nyblom_exact
## 1      -0.03377687      0.2212113    -0.03377687    -0.03377687  -0.03377687
## 2       1.52483138      2.6786278     1.52483138     2.67862782   2.67862782
##   nyblom_interp        boot
## 1    0.07894831 -0.03377687
## 2    1.54608644  1.26565726</code></pre>
<p>In order to evaluate the various methods and implementations we conduct a Monte Carlo simulation study to assess each methods' coverage. For this purpose we write a small wrapper function to conduct the simulation study using <a href="http://gforge.se/2015/02/how-to-go-parallel-in-r-basics-tips/">parallel computation</a>. The function wraps the <code>quantileCI::qci_coverage_one_sim</code> function, which lets the user define a simulation scenario (true underlying distribution, size of the sample, etc.), then applies all confidence interval methods gathered in the above <code>quantile_confints</code> and finally assesses whether each confidence interval covers the true value or not.</p>
<div><pre><code>simulate.coverage_qci &lt;-<span> </span>function(<span>n=</span>n,<span>p=</span>p,<span>conf.level=</span><span>0.9</span>, <span>nSim=</span><span>10e3</span>, ...) {
  ##Windows users: change to below lapply function or use snow.
  ##lapplyFun &lt;- function(x, mc.cores=NA, ...) pblapply(x, ...)
  lapplyFun &lt;-<span> </span>parallel::mclapply

  sims &lt;-<span> </span>dplyr::<span>bind_rows</span>(
    <span>lapplyFun</span>(1L:nSim, function(i) {
      quantileCI::<span>qci_coverage_one_sim</span>(<span>qci_fun=</span>quantile_confints, <span>n=</span>n,<span>p=</span>p,<span>conf.level=</span>conf.level,...)
    }, <span>mc.cores =</span> parallel::<span>detectCores</span>() -<span> </span><span>1</span>)
  ) %>%<span> </span><span>summarise_each</span>(<span>funs</span>(mean))
  <span>return</span>(sims)
}</code></pre></div>
<h4>Simulation 1</h4>
<p>We can now compare the coverage of the different implementation for the particular <code>n</code>=25 and <code>p</code>=0.8 setting:</p>
<div><pre><code><span>simulate.coverage_qci</span>(<span>n=</span><span>25</span>, <span>p=</span><span>0.8</span>, <span>conf.level=</span><span>0.95</span>)</code></pre></div>
<pre><code>##   jmuOutlier_exact EnvStats_exact EnvStats_asymp asht_quantTest nyblom_exact
## 1           0.9536         0.9473         0.9536         0.9786       0.9786
##   nyblom_interp   boot
## 1        0.9464 0.9154</code></pre>
<p>Note that the <code>nyblom_interp</code> procedure is closer to the nominal coverage than it's exact cousin <code>nyblom_exact</code> and the worst results are obtained by the bootstrap percentile method. We also note that the results of the <code>jmuOutlier_exact</code> method appear to deviate from <code>asht_quantTest</code> as well as <code>nyblom_exact</code>, which is surprising, because they should implement the same approach.</p>
<h4>Simulation 2</h4>
<p>As a further test-case we consider the situation for the median in a smaller sample:</p>
<div><pre><code><span>simulate.coverage_qci</span>(<span>n=</span><span>11</span>, <span>p=</span><span>0.5</span>, <span>conf.level=</span><span>0.95</span>)</code></pre></div>
<pre><code>##   jmuOutlier_exact EnvStats_exact EnvStats_asymp asht_quantTest nyblom_exact
## 1           0.9873         0.9352          0.961         0.9873       0.9873
##   nyblom_interp   boot hs_interp
## 1        0.9462 0.9352    0.9462</code></pre>
<p>We note that the <code>EnvStats_exact</code> procedure again has a lower coverage than the nominal required level, it must therefore implement a slightly different procedure than expected. That coverage is less than the nominal for an exact method is, however, somewhat surprising.</p>
<p>In this study for the median, the original <span>Hettmansperger and Sheather (1986)</span> procedure implemented in <code>quantileCI</code> as function <code>median_confint_hs</code> is also included in the comparison (<code>hs_interp</code>). Note that the <span>Nyblom (1992)</span> procedure for <span>\(p=\frac{1}{2}\)</span> just boils down to this approach. Since the neighbouring order statistics are combined using a weighted mean, the actual level is just close to the nominal level. It can, as observed for the above setting, be slightly lower than the nominal level. The bootstrap method again doesn't look too impressive.</p>
<h4>Simulation 3</h4>
<p>We finally also add one of the scenarios from Table 1 of the <span>Nyblom (1992)</span> paper, which allows us to check our implementation against the numerical integration to assess coverage in the paper.</p>
<div><pre><code><span>simulate.coverage_qci</span>(<span>n=</span><span>11</span>, <span>p=</span><span>0.25</span>, <span>conf.level=</span><span>0.90</span>)</code></pre></div>
<pre><code>##   jmuOutlier_exact EnvStats_exact EnvStats_asymp asht_quantTest nyblom_exact
## 1           0.9249         0.7722         0.8472         0.9249       0.9249
##   nyblom_interp   boot
## 1        0.9033 0.8848</code></pre>
<p>In particular the results of <code>EnvStats_exact</code> look disturbing. The coverage of the interpolated order statistic approach again looks convincing.</p>
<h4>Simulation 4</h4>
<p>Finally, a setup with a large sample, but now with the t-distribution with one degree of freedom:</p>
<div><pre><code><span>simulate.coverage_qci</span>(<span>n=</span><span>101</span>, <span>p=</span><span>0.9</span>, <span>rfunc=</span>rt, <span>qfunc=</span>qt, <span>conf.level=</span><span>0.95</span>, <span>df=</span><span>1</span>)</code></pre></div>
<pre><code>##   jmuOutlier_exact EnvStats_exact EnvStats_asymp asht_quantTest nyblom_exact
## 1           0.9553         0.9343         0.9553         0.9553       0.9553
##   nyblom_interp   boot
## 1        0.9502 0.9306</code></pre>
<p>Again the interpolation method provides the most convincing results. The bootstrap on the other hand again has the worst coverage, a larger <span>\(R\)</span> might have helped here, but would have made the simulation study even more time consuming.</p>
<h1>Conclusion and Future Work</h1>
<p>Can we based on the above recommend one procedure to use in practice? Well, even though the simulation study is small, the exact <code>EnvStats::eqnpar</code> approach appears to yield below nominal coverage intervals, sometimes even substantially, and hence is not to be recommended. On the other hand, <code>jmuOutlier_exact</code>, <code>asht_quantTest</code>, and <code>nyblom_exact</code> in all four cases provide above nominal level coverage, i.e. the intervals are conservative in as much as they are too wide. Also slightly disturbing is that the results of the exact confidence interval methods varied somewhat between the different R implementations. Part of the differences arise from handling the discreteness of the procedure as well as the edge cases differently. The basic percentile bootstrap method is a simple approach, providing acceptable, but not optimal coverage and also depends in part on <span>\(R\)</span>. In particular for very large <span>\(n\)</span> or for a large number of replication in the simulation study, the method with a large <span>\(R\)</span> can be slow. Suggestions exist in the literature on how to improve the speed of coverage convergence by smoothing (see, e.g., <span>De Angelis, Hall, and Young (1993)</span>), but such work is beyond the scope of this post.</p>
<p>The <span>Hettmansperger and Sheather (1986)</span> and <span>Nyblom (1992)</span> method, respectively, provide very good coverage close to the nominal level. The method is fast to compute, available through the <code>quantileCI</code> R package and would be our recommendation to use in practice.</p>
<p>Altogether, we summarise our findings as follows: <strong>More confidence in confidence intervals for quantiles!</strong> and let the following picture illustrating 90% confidence intervals for the 80% quantile of the standard normal distribution based on the above sample of size <span>\(n\)</span>=25 say this in less than 1000 words.</p>
<h1>References</h1>
<div>
<div>
<p>De Angelis, D., P. Hall, and G. A. Young. 1993. “A Note on Coverage Error of Bootstrap Confidence Intervals for Quantiles.” Mathematical Proceedings of the Cambridge Philosophical Society 114: 517–31. <a href="http://sci-prew.inf.ua/v114/3/S0305004100071802.pdf">http://sci-prew.inf.ua/v114/3/S0305004100071802.pdf</a>.</p>
</div>
<div>
<p>Falk, Michael, and Edgar Kaufmann. 1991. “Coverage Probabilities of Bootstrap-Confidence Intervals for Quantiles.” Ann. Statist. 19 (1). The Institute of Mathematical Statistics: 485–95. doi:<a href="https://doi.org/10.1214/aos/1176347995">10.1214/aos/1176347995</a>.</p>
</div>
<div>
<p>Hettmansperger, T. P., and S. J Sheather. 1986. “Confidence Intervals Based on Interpolated Order Statistics.” Statistics and Probability Letters 4: 75–79. doi:<a href="https://doi.org/10.1016/0167-7152(86)90021-0">10.1016/0167-7152(86)90021-0</a>.</p>
</div>
<div>
<p>Höhle, J., and M. Höhle. 2009. “Accuracy Assessment of Digital Elevation Models by Means of Robust Statistical Methods.” ISPRS Journal of Photogrammetry and Remote Sensing 64 (4): 398–406. doi:<a href="https://doi.org/10.1016/j.isprsjprs.2009.02.003">10.1016/j.isprsjprs.2009.02.003</a>.</p>
</div>
<div>
<p>Hyndman, R. J., and Y. Fan. 1996. “Sample Quantiles in Statistical Packages.” American Statistician 50 (4): 361–65. doi:<a href="https://doi.org/10.2307/2684934">10.2307/2684934</a>.</p>
</div>
<div>
<p>Nyblom, J. 1992. “Note on Interpolated Order Statistics.” Statistics and Probability Letters 14: 129–31. <a href="http://staff.math.su.se/hoehle/blog/10.1016/0167-7152(92)90076-H">10.1016/0167-7152(92)90076-H</a>.</p>
</div></div>