Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: quartiles

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18232] Re: [mg18214] quartiles
  • From: "Wolf, Hartmut" <hwolf at debis.com>
  • Date: Thu, 24 Jun 1999 14:24:16 -0400
  • Organization: debis Systemhaus
  • References: <199906230041.UAA04362@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello Tom, 

Tom De Vries schrieb:
> 
> Hello !
> 
> I am working with some statistics problems and have a question about finding
> quartiles for a set of data
> 
> Load in the package
> 
> Needs["Statistics`DescriptiveStatistics`"]
> 
> create a set of data
> 
> salaries =
> {250000,100000,60000,60000,40000,40000,40000,40000,25000,20000,20000,20000,
>   18000,16000,16000}
> 
> ask for the quartiles
> 
> Quartiles[salaries]
> 
> and this is the response
> {20000,40000,55000}
> 
> At this point I am probably revealing my ignorance of statistics....
> 
> 250000,100000,60000,60000,40000,40000, 40000
> 40000,  Median
> 25000,20000,20000,20000,18000,16000,16000
> 
> The lower quartile is the median of the values below the median, which I get
> with Mathematica
> 25000,20000,20000,
> 20000,
> 18000,16000,16000
> 
> The upper quartile should be the median of the numbers above the median, so
> why is it 55000?
> 250000,100000,60000,
> 60000,
> 40000,40000, 40000
> 
> Does Mathematica use some algorithm to get rid of outliers before finding
> quartiles,  or does it eliminate the median from the data set before finding
> the quartiles, .....?
> 
> The set of data I used as an example was taken from the math text I am using
> and the answer the text supplies, and the answer I think I should get, is
> different from the one Mathematica gets.  I would appreciate any advice on this!
> 

In[3]:= Needs["Statistics`DescriptiveStatistics`"]
In[4]:= salaries =
{250000,100000,60000,60000,40000,40000,40000,40000,25000,
 20000,20000,20000,18000,16000,16000}

In[5]:= Quartiles[salaries] 
Out[5]= {20000,40000,55000}

How is this to be interpreted? Look at

In[8]:= ?Quartiles
"Quartiles[list] gives a list of the interpolated .25, .50, and .75
quantiles of the entries in list."

Regard "interpolated". However if you do

In[9]:= Quantile[salaries,#]&/@{1/4,1/2,3/4}
Out[9]= {20000,40000,60000}

which might be what you expect. 

But I think your definitions of lower and upper quartile are imprecise
(what does "values below/above the median" mean exactly?) and sometimes
incorrect. See:

In[17]:= distr={1,1,1,2,3,3,3,3,3,3,4,4,4,4,4};
In[18]:= Quantile[distr,#]&/@{1/4,1/2,3/4}
Out[18]= {2,3,4}

But

In[19]:= Median[With[{m=Median[distr]},Select[distr,#<m&]]]
Out[19]= 1
In[20]:= Median[With[{m=Median[distr]},Select[distr,#>=m&]]]
Out[20]= 3

kind regards, hw



  • References:
    • quartiles
      • From: "Tom De Vries" <tdevries@shop.westworld.ca>
  • Prev by Date: Re: Moving average type process
  • Next by Date: phasing out support for older versions
  • Previous by thread: quartiles
  • Next by thread: Re: quartiles