qexact | R Documentation |
Compute exact confidence intervals for quantiles of continuous random variables using binomial probabilities
qexact(x, probs = 0.5, level = 0.95)
x |
numeric vector whose sample quantile and confidence intervals are to be calculated. |
probs |
numeric vector of probabilities with values in |
level |
nominal coverage level of the confidence interval. |
This function calculates exact confidence intervals for quantiles at level probs
from a vector x
of length n
. It does so by first determining the confidence level for all possible pairwise combinations of order statistics from 1 to n
. This entails "n
choose 2
" possible confidence intervals before selecting the one with the level closest to level
. If the procedure yields more than one such confidence intervals, then the interval with smallest width is returned.
Caution: for large n
, the procedure may reach the limit on the number of nested expressions. See gtools::combinations
and options(expressions)
for additional information. However, if you have a large n
, then consider estimating an asymptotic approximation of the confidence interval.
Marco Geraci
Thompson W. R. On confidence ranges for the median and other expectation distributions for populations of unknown distribution form. The Annals of Mathematical Statistics 1936;7(3):122-128.
x <- rnorm(100)
qexact(x, p = c(0.1,0.5), level = 0.9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.