s-news
[Top] [All Lists]

Re: Quartiles

To: Harvey.Monder@pharma.com (Monder, Harvey)
Subject: Re: Quartiles
From: "Edward Malthouse" <ecm@casbah.it.northwestern.edu>
Date: Fri, 7 Dec 2001 12:42:28 -0600 (CST)
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <E5EC0556E8B6D2118CB600A0C9B6BB6003BA585E@a2mbx01.pharma.com> from "Monder, Harvey" at Dec 07, 2001 01:15:49 PM
See Hyndman and Fan (1996), "Sample quantiles in statistical
packages,"  American Statistician, Vol 50, number 4, pp-361-365.

If I recall correctly, they give about 9 different definitions of
quantiles that have been proposed in the literature and a list of
desirable properties.  They show which definitions have which
properties.  As I recall, the method they recommend isn't in SAS,
SPSS, or S-plus.  The default in SAS is one of the better ones.

Functions that compute quantiles in S-plus are (were not)
consistent (Here is an example using S-plus 2000.  It may have been
fixed as there was discussion on this list a few years ago.):

> x <- c(8,9,10,11,14,20)
> quantile(x)
   0%  25%  50%   75% 100% 
    8 9.25 10.5 13.25   20
> summary(x)
 Min. 1st Qu. Median Mean 3rd Qu. Max. 
    8    9.25   10.5   12    13.2   20

Ed Malthouse
Dr. Edward C. Malthouse
Assistant Professor
Integrated Marketing Communications Department
Medill School of Journalism
1908 Sheridan Road
Evanston, IL  60208-1290
Tele:  847-467-3376
Fax:  847-491-5925

> 
> And in SAS, Proc Univariate provides 5 algorithms (pctldef), the fourth
> producing the same results as SPSS, but none of them producing the results
> in Splus.
> (As to the rightness or wrongness of SAS, I will leave that to your
> discretion)
> 
>       Dr. H. Monder
> 
> -----Original Message-----
> From: Dr. M.Sawada [mailto:msawada@uottawa.ca]
> Sent: Friday, December 07, 2001 11:54 AM
> To: 'Prof Brian Ripley'; 'Heeringa W.J.'
> Cc: s-news@lists.biostat.wustl.edu
> Subject: Re: [S] Quartiles
> 
> 
> 
> Incidentally, MS Excel uses the same quantile algorithm as S+ - and Bill
> Gates is never wrong.
> 
> Dr. M.Sawada
> Assistant Professor, GIS
> University of Ottawa
> Dept. Geography
> P.O. Box 450 Stn. A
> Ottawa, ON K1N 6N9
> Tel: 613-562-5800 x1040
> Fax: 613-562-5145
> Eml: msawada@uottawa.ca 
>  
> 
> -----Original Message-----
> From: s-news-owner@lists.biostat.wustl.edu
> [mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Prof Brian
> Ripley
> Sent: Friday, December 07, 2001 11:32 AM
> To: Heeringa W.J.
> Cc: s-news@lists.biostat.wustl.edu
> Subject: Re: [S] Quartiles
> 
> 
> On Fri, 7 Dec 2001, Heeringa W.J. wrote:
> 
> > Dear S-PLUS users,
> >
> > Assume I have the following range:
> > 1 2 3 4 5 6
> >
> > Next I calculated the 1st Quartile, the median and the 3rd Quartile in
> 
> > both, S-PLUS and SPSS:
> >
> > 1st Quartile : S-PLUS: 2.25 and SPSS: 1.75
> > median       : S-PLUS:  3.5 and SPSS: 3.5
> > 3rd Quartile: S-PLUS: 4.75 and SPSS: 5.25
> >
> > Or for this range:
> > 1 2 3 4 5 6 7 8
> >
> > the results are:
> >
> > 1st Quartile : S-PLUS: 2.75 and SPSS: 2.25
> > median       : S-PLUS:  4.5 and SPSS: 4.5
> > 3rd Quartile: S-PLUS: 6.25 and SPSS: 6.75
> >
> > So S-PLUS and SPSS give different results. Which results are correct? 
> > And how can these results be explained?
> 
> Why don't you send a bug report to SPSS if they don't explain their
> results?  If it's not in the on-line help it is a bug, but for S-PLUS it
> *is* there.
> 
> There are several slightly different definitions of quantiles (and hence
> quartiles), but ?quantile in S-PLUS tells you what it uses.
> 
> -- 
> Brian D. Ripley,                  ripley@stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> ---------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news
> 
> ---------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news
> ---------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news
> 


<Prev in Thread] Current Thread [Next in Thread>