# Compute exact confidence interval for median of a sample based on order statistics

### Description

Given a sample *X_1, ..., X_n*, this function computes an exact confidence interval for the median of the sample
based on the binomial distribution.

### Usage

1 | ```
confIntMedian(x, conf.level = 0.95)
``` |

### Arguments

`x` |
Vector of observations. |

`conf.level` |
Confidence level for confidence interval. |

### Value

Table containing the median and the confidence interval.

### Author(s)

Kaspar Rufibach

kaspar.rufibach@gmail.com

### References

Lehmann, E. (1975).
Nonparametrics: Statistical Methods Based on Ranks.
*Holden-Day*, 182–183.

A worked out example (in Section 5, p. 38) can be found in

Altman, D.G., Machin, D., Bryant, T.N., Gardner, M.J.(2000). Statistics with confidence. University Press Belfast.

### Examples

1 2 3 4 5 6 7 8 9 10 11 | ```
# generate random sample
set.seed(1977)
n <- 40
x <- rnorm(n)
# compute CI for median
confIntMedian(x, conf.level = 0.95)
# data from Altman (2000), p. 38
x <- c(66, 71.2, 83, 83.6, 101, 107.6, 122, 143, 160, 177, 414)
confIntMedian(x, conf.level = 0.95)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.