[R] quantile question

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl
Thu Jan 22 18:05:58 CET 2009


have a look at the online help file of ?quantile(); check also:

x <- c(67.12, 64.51, 62.06, 55.45, 51.41, 43.78, 10.74, 10.14)
sapply(1:9, function (i) quantile(x, c(0.05, 0.95), type = i))


I hope it helps.

Best,
Dimitris


ANJAN PURKAYASTHA wrote:
> Hi,
> A simple quantile question:
> I need to calculate the 95% and 5% quantiles (aka percentiles) for the
> following data:
> 67.12
> 64.51
> 62.06
> 55.45
> 51.41
> 43.78
> 10.74
> 10.14
> 
> if I use the formula: 95% quantile point= 95 (8+1)/100, I get the 8.55th
> point as the 95% quantile. Which does not make too much sense as I have only
> 8 data points.
> The other option is to use (95*8)/100 = 7.6th data point (which can be found
> by interpolation between the 7th and 8th data points).
> Reportedly, the second formula is not too accurate. However in my case the
> first formula does not make much sense.
> 
> Any advice?
> 
> TIA,
> Anjan
> 

-- 
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014




More information about the R-help mailing list