question on five number summary & quantile.

4k Views Asked by At

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?

2

There are 2 best solutions below

0
On

$\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$.

0
On

"Five-number summary" refers to "minimum value", "lower hinge (or first quartile)", "median", "upper hinge (or third quartile)" and "maximum value".

When there is an odd number of data, Tukey's hinge method ("fivenum" function in the statistical software R) and the standard quartile method ("quantile" function in the statistical software R) give the same results.

When there is an even number of data and Tukey's hinge method is used, the lower hinge is the median of the lower half of data and the upper hinge is the median of the upper half of the data.

When there is an even number of data and the standard quartile method is used, the lower quartile is the 25th percentile of the data and the upper quartile is the 75th percentile of the data.

For more examples about the differences between the five-number summary calculations, you can use the following link: https://www.icalcu.com/stat/fivenum.html