I was asked to calculate BY HAND the IQR of this data
-1,400 -1,000 -0,600 0,400 1,000 1,700 2,300 2,600 3,300 3,700 4,400 4,600 7,000 7,500 7,700 13,500 18,500
The results are
MEDIAN 3.300
1 QUARTILE 1
3 QUARTILE 7
Q3-Q1=IQR = 7-1=6
My results were also confirmed by R.
x <- c(-1.400,-1.000,-0.600,0.400,1.000,1.700,2.300,2.600,3.300,3.700,4.400,4.600,7.000,7.500,7.700,13.500,18.500)
summary(x)
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# -1.400 1.000 3.300 4.424 7.000 18.500
The problem is that they expect instead this value instead.
1 QUARTILE 0.7
3 QUARTILE 7.25
IQR= 6.55
Could someone explain what is happening? Where is my miscalculation or misuse?
There are 9 different ways of calculating quantiles that are implemented by the
quantile
function in R. You can read about these by doing?quantile
and test them all on your vector by doing:You can see that your method is 1, 2, or 7, (R's default is method 7), and the "expected" answer is method 6. If you were simply asked asked to work out the first and third quartiles, you should be given guidance on the expected method.