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 -- ============================anjan purkayastha, phd bioinformatics analyst whitehead institute for biomedical research nine cambridge center cambridge, ma 02142 purkayas [at] wi [dot] mit [dot] edu 703.740.6939 [[alternative HTML version deleted]]
Read the help page for the quantile function (the whole page, there is a lot of good detail in there), the 2nd reference on the page should also be a helpful read. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of ANJAN PURKAYASTHA > Sent: Thursday, January 22, 2009 9:52 AM > To: r-help at r-project.org > Subject: [R] quantile question > > 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 > > -- > ============================> anjan purkayastha, phd > bioinformatics analyst > whitehead institute for biomedical research > nine cambridge center > cambridge, ma 02142 > > purkayas [at] wi [dot] mit [dot] edu > 703.740.6939 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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.
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
Thanks all for your prompt and helpful replies! Anjan On Thu, Jan 22, 2009 at 11:52 AM, ANJAN PURKAYASTHA < anjan.purkayastha@gmail.com> 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 > > -- > ============================> anjan purkayastha, phd > bioinformatics analyst > whitehead institute for biomedical research > nine cambridge center > cambridge, ma 02142 > > purkayas [at] wi [dot] mit [dot] edu > 703.740.6939 >-- ============================anjan purkayastha, phd bioinformatics analyst whitehead institute for biomedical research nine cambridge center cambridge, ma 02142 purkayas [at] wi [dot] mit [dot] edu 703.740.6939 [[alternative HTML version deleted]]