ci_quantile: Confidence Interval for a Population Quantile

View source: R/ci_quantile.R

ci_quantileR Documentation

Confidence Interval for a Population Quantile

Description

This function calculates confidence intervals for a population quantile. By default, distribution-free confidence intervals based on the binomial distribution are formed, see Hahn and Meeker. Alternatively, bootstrap confidence intervals are available.

Usage

ci_quantile(
  x,
  q = 0.5,
  probs = c(0.025, 0.975),
  type = c("binomial", "bootstrap"),
  boot_type = c("bca", "perc", "norm", "basic"),
  R = 9999,
  seed = NULL,
  ...
)

Arguments

x

A numeric vector.

q

A single probability value determining the quantile. Set to 0.5 for the median (the default).

probs

Error probabilites. The default c(0.025, 0.975) gives a symmetric 95% confidence interval.

type

Type of confidence interval. One of "binomial" (default), or "bootstrap".

boot_type

Type of bootstrap confidence interval ("bca", "perc", "norm", "basic"). Only used for type = "bootstrap".

R

The number of bootstrap resamples. Only used for type = "bootstrap".

seed

An integer random seed. Only used for type = "bootstrap".

...

Further arguments passed to boot::boot.

Details

Bootstrap confidence intervals are calculated by the package "boot", see references. The default bootstrap type is "bca" (bias-corrected accelerated) as it enjoys the property of being second order accurate as well as transformation respecting (see Efron, p. 188).

Value

A list with class cint containing these components:

  • parameter: The parameter in question.

  • interval: The confidence interval for the parameter.

  • estimate: The estimate for the parameter.

  • probs: A vector of error probabilities.

  • type: The type of the interval.

  • info: An additional description text for the interval.

References

  1. Hahn, G. and Meeker, W. (1991). Statistical Intervals. Wiley 1991.

  2. Efron, B. and Tibshirani R. J. (1994). An Introduction to the Bootstrap. Chapman & Hall/CRC.

  3. Canty, A and Ripley B. (2019). boot: Bootstrap R (S-Plus) Functions.

See Also

ci_quantile.

Examples

x <- 1:100
ci_quantile(x)
ci_quantile(x, q = 0.25)
ci_quantile(x, q = 0.25, type = "bootstrap", R = 999)

confintr documentation built on Sept. 29, 2022, 5:13 p.m.