Wednesday, January 16, 2008

Quartiles in HW1

Recall from a previous post that different software packages have different ways of calculating quartiles.

The formula for quartiles that we learned in class is:
Position of Q1 = (n+1)/4
Position of Q2 = (n+1)/2
Position of Q3 = 3
(n+1)/4

Example: Let's say your data set is (2, 4, 6, 8, 10, 12, 14, 16)
n = 8
Position of Q1 = 9/4 = 2.25
We interpolate between the 2nd value (4) and the 3rd value (6) and get Q1 = 4.5

I haven't checked the documentation, but I've empirically determined that Minitab uses this same formula.

[EDIT] Before I go on to talk about Excel, I need to mention that the last step of interpolating between values is NOT how our book instructs us to calculate the quartile. Jeffrey McNamara pointed out to me that Rule 3 on page 77 says:

If the result is neither a whole number nor a fractional half, you round the result to the nearest integer and select that ranked value.
So in our example, where the position of Q1 is 2.25, we would round that to 2 and select the 2nd ranked value which is 4.

Again, Minitab uses the interpolation method and, as Frank Cardulla used to say, "You pays your money, you takes your choice."

Kudos to Jeff for the catch!
[/EDIT]

Excel uses a different formula which is apparently:
Position of Q1 = (n+3)/4

In our example, this would mean:
Position of Q1 = 11/4 = 2.75
Interpolating .75 between the 2nd and 3rd value gives us Q1 = 5.5

This is indeed what MS Excel calculated when I used the Quartile function on this data set.

Conclusion: It seems to me to be a good idea to use [either the book method or] Minitab (or manual calculations) to calculate the quartiles for the homework.

No comments: