       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
>
>
> Needs["Statistics`DescriptiveStatistics`"]
>
> create a set of data
>
> salaries =
> {250000,100000,60000,60000,40000,40000,40000,40000,25000,20000,20000,20000,
>   18000,16000,16000}
>
>
> 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:= Needs["Statistics`DescriptiveStatistics`"]
In:= salaries =
{250000,100000,60000,60000,40000,40000,40000,40000,25000,
20000,20000,20000,18000,16000,16000}

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

How is this to be interpreted? Look at

In:= ?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:= Quantile[salaries,#]&/@{1/4,1/2,3/4}
Out= {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:= distr={1,1,1,2,3,3,3,3,3,3,4,4,4,4,4};
In:= Quantile[distr,#]&/@{1/4,1/2,3/4}
Out= {2,3,4}

But

In:= Median[With[{m=Median[distr]},Select[distr,#<m&]]]
Out= 1
In:= Median[With[{m=Median[distr]},Select[distr,#>=m&]]]
Out= 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