Am I Calculating Quartiles Correctly?

Here is my data set: 5, 8, 12, 42, 43

I am trying to work out the first quartile. When using R (the programming language) it shows the 1st quartile as 8, but when I work it out manually, it shows it as 6.5.

Here's how I am working it out:

First I work out the 25%

25/100 * (5 + 1)


Which is:

1.5


There is no value at 1.5, so I do the following to get the average:

(5 + 8) / 2


Which equals:

6.5


Where am I going wrong?

-

There are 9 methods defined for computing quantiles, see the help page for quantile in R for the details. You can choose between them using the type argument, the default is 7.

Your method corresponds to type 6 (and is that used by Minitab and SPSS):

x <- c(5, 8, 12, 42, 43)
sapply(1:9, function(y) quantile(x,type=y))["25%",,drop=FALSE]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]   [,9]
25%    8    8    5 5.75 7.25  6.5    8    7 7.0625


Each method uses a different weighted average of consecutive order statistics. The methods are defined in Hyndman, R. J. and Fan, Y. (1996) Sample quantiles in statistical packages, American Statistician, 50, 361–365.

-
Thank you James for clearing that up. I thought I was doing something wrong. – James Jeffery Dec 31 '13 at 13:33