Reputation:
I have the following data set (n = 20
).
35, 50, 50, 50, 60, 75, 75, 75, 80,85,85,90,90,100,100,100,100,125,125,150
I try to find the first quantile. I do it manually as follows:
(25 / 100) * 20 = 5.
That means, the average of the 5th
and the 6th
positions, as follows:
(60+75)/2 = 67.5
However, when I do it in excel or R, they gave me, Q_1 = 71.25
Could you please help me to understand the problem?
Upvotes: 1
Views: 205
Reputation: 84529
R has nine types of quantiles. Perhaps you need type 2:
> x = c(35, 50, 50, 50, 60, 75, 75, 75, 80,85,85,90,90,100,100,100,100,125,125,150)
> quantile(x, probs = 0.25, type = 2)
25%
67.5
Upvotes: 1
Reputation: 804
python will do the same
the reason is that the cutoff is between 60 and 75, but 75 is present 3 times, so the calculation is not (60+75)/2=67.5
but rather (60+75+75+75)/4=71.25
Upvotes: 0