[R] Confidence intervals of quantiles

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Mon Feb 5 15:43:46 CET 2007


you could use the Bootstrap method, using package 'boot', e.g.,

library(boot)

f.quantile <- function(x, ind, ...){
    quantile(x[ind], ...)
}

###########

x <- rgamma(750, 2)
quant.boot <- boot(x, f.quantile, R = 1000, probs = c(0.025, 0.25, 
0.5, 0.75, 0.975))
lapply(1:5, function(i) boot.ci(quant.boot, c(0.90, 0.95), type = 
c("perc", "bca"), index = i))

y <- rgamma(150, 2)
quant.boot <- boot(y, f.quantile, R = 1000, probs = c(0.025, 0.25, 
0.5, 0.75, 0.975))
lapply(1:5, function(i) boot.ci(quant.boot, c(0.90, 0.95), type = 
c("perc", "bca"), index = i))


However, you should be a little bit careful with Bootstrap if you wish 
to obtain CIs for extreme quantiles in small samples.

I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Mike White" <mikewhite.diu at btconnect.com>
To: <R-help at stat.math.ethz.ch>
Sent: Monday, February 05, 2007 2:47 PM
Subject: [R] Confidence intervals of quantiles


> Can anyone please tell me if there is a function to calculate 
> confidence
> intervals for the results of the quantile function.
> Some of my data is normally distributed but some is also a squewed
> distribution or a capped normal distribution. Some of the data sets 
> contain
> about 700 values whereas others are smaller with about 100-150 
> values, so I
> would like to see how the confidence intervals change for the 
> different
> distributions and different data sizes.
>
> Thanks
> Mike White
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list