View source: R/confIntMedian.R
confIntMedian | R Documentation |
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.
confIntMedian(x, conf.level = 0.95)
x |
Numeric vector of observations. |
conf.level |
Confidence level for confidence interval. |
data.frame containing the median and the confidence interval.
Kaspar Rufibach
kaspar.rufibach@gmail.com
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.
# generate random sample
set.seed(1977)
x <- rnorm(40)
# compute CI for median
confIntMedian(x = x, conf.level = 0.95)
# data from Altman (2000), p. 38
x2 <- c(66, 71.2, 83, 83.6, 101, 107.6, 122, 143, 160, 177, 414)
confIntMedian(x = x2, conf.level = 0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.