Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i know that in five number summary :

25% of a data set lies between Min & 1st quartile.

50% of a data set lies between Min & 2nd quartile, that is, Median.

75% of a data set lies between Min & 3rd quartile.

& 100% of a data set lies between Min & Max.

But my cocept is contradicting as i run a data set in R Programming Language.

while i wrote the command fivenum(x) & quantile(x) the percentiles are not matching that is, "the 1st quartile of fivenum(x)" is not "the the value below which 25% of the data fall in quantile(x)"

the commands that i have run in R console:

y <- c(7,12,9,1)

fivenum(y)

[1] 1.0 4.0 8.0 10.5 12.0

quantile(y)

0% 25% 50% 75% 100%

1.00 5.50 8.00 9.75 12.00

by which points am i being misleading?

share|cite|improve this question

$\frac{n+1}{2}\times 25\% =1.25\\ \frac{n+1}{2}\times 75\% =3.75$

The fivenum command takes the $25^{th}$ percentile as the number half way between $1$ and $7$ and the $75^{th}$ as the number half way between $9$ and $12$, whereas the quantile command may have been an attempt to produce the numbers $0.25$ of the way between $1$ and $7$ and $0.75$ of the way between $9$ and $12$ that contained an error and ended up giving the numbers $0.25$ of the way between 7 and 1 and $0.75$ of the way between $12$ and $9$.

share|cite|improve this answer

I see a few getting confused between the quartiles given by summary() and fivenum().

Firstly - summary() gives the following summary statistics:

[Minimum] [1st Quartile] [Median] [Mean] [3rd Quartile] [Maximum]

where as,

fivenum() returns Tukey's five number summary i.e.

[Minimum] [Lower hinge] [Median] [Upper hinge] [Maximum]

Here comes the confusion - what's the difference between the quartiles and lower/upper hinges?

Let me explain with an example - Try this in R:

First - with a vector "y" of odd number of values (5 in this example)

> y=c(2, 5, 8, 15, 8) 
> summary(y)    Min. 1st Qu.  Median    Mean 3rd Qu.   Max. 
>               2.0     5.0     8.0     7.6     8.0    15.0  
> fivenum(y)  
> [1]  2  5  8  8 15

As you can see results are the same, except that summary() gave the mean value in addition to what fivenum() displayed.

Now I am including just one more variable (new value: 12) and defined this vector as "z"; Note that the vector count is now even (6 values)

> z=c(2, 5, 8, 12, 15, 18)
> summary(z)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   2.00    5.75   10.00   10.00   14.25   18.00 
> fivenum(z)
[1]  2  5 10 15 18

Now see the difference - while summary() gave you the quartiles (calculated values based on quartile or percentile formulae), this is what fivenum() does - making it really simple - you can do it without math calculations:

Description of fivenum() output:

Firstly, min, median & max values given by fivenum() are straight forward!

Lower Hinge = median of the values to the left of (MEDIAN OF ALL VALUES) = median of the values that are less than 10 = median of (2,5,8) = 5

Upper hinge = median of the values to the right of (MEDIAN OF ALL VALUES) = median of the values that are greater than 10 = median of (12,15,18) = 15

share|cite|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.