quantileCI | R Documentation |
These functions can be used to compute confidence intervals for quantiles (including median).
quantileCI(x, prob = 0.5, conf.level = 0.95, method = "exact", minLength = FALSE, na.rm = FALSE) medianCI(x, conf.level = 0.95, method = "exact", minLength = FALSE, na.rm = FALSE) madCI(x, conf.level = 0.95, method = "exact", minLength = FALSE, na.rm = FALSE, constant = 1.4826)
x |
numeric data vector |
prob |
quantile |
conf.level |
confidence level |
method |
character string specifing which method to use; see details. |
minLength |
logical, see details |
na.rm |
logical, remove |
constant |
scale factor (see |
The exact confidence interval (method = "exact"
) is computed using binomial
probabilities; see Section 6.8.1 in Sachs and Hedderich (2009). If the result is not
unique, i.e. there is more than one interval with coverage proability closest to
conf.level
, then a matrix of confidence intervals is returned.
If minLength = TRUE
, an exact confidence interval with minimum length is
returned.
The asymptotic confidence interval (method = "asymptotic"
) is based on the
normal approximation of the binomial distribution; see Section 6.8.1 in Sachs and Hedderich (2009).
A list with components
estimate |
the sample quantile. |
CI |
a confidence interval for the sample quantile. |
Matthias Kohl Matthias.Kohl@stamats.de
L. Sachs and J. Hedderich (2009). Angewandte Statistik. Springer.
binom.test
, binconf
## To get a non-trivial exact confidence interval for the median ## one needs at least 6 observations set.seed(123) x <- rnorm(8) ## exact confidence interval not unique medianCI(x) madCI(x) ## minimum length exact confidence interval medianCI(x, minLength = TRUE) madCI(x, minLength = TRUE) ## asymptotic confidence interval medianCI(x, method = "asymptotic") madCI(x, method = "asymptotic") ## confidence interval for quantiles quantileCI(x, prob = 0.4) quantileCI(x, prob = 0.6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.