20.1.6 Quartiles
Recall that the quartiles of a list of numbers divide it into four
equal parts; the first quartile is the number q1 such that
one-fourth of the list numbers fall below q1; i.e., the median of
that part of the list which fall at or below the list median. The
second quartiles is the number q2 such that half of the list
numbers fall at or below q2; more specifically, the median of the
list. And of course the third quartile is the number q3 such that
three-fourths of the list numbers fall at or below q3.
The function quartiles
finds the minimum of a list,
the first quartile, the second quartile, the third quartile and the
maximum of the list.
-
quartiles takes one mandatory argument and one optional
argument:
-
L, a list of numbers.
- Optionally, W, a list of weights.
- quartiles(L ⟨,W⟩) returns a column
vector consisting of the minimum, first second and third quartile,
and the maximum of L.
The min,
quartile1,
median, quartile3
and max commands find the individual entries of this list.
Example
A:=[0,1,2,3,4,5,6,7,8,9,10,11];
quartiles(A) |
|
| ⎡
⎢
⎢
⎢
⎢
⎢
⎣ | | ⎤
⎥
⎥
⎥
⎥
⎥
⎦ |
|
| | | | | | | | | | |
|
min(A),quartile1(A),median(A),quartile3(A),max(A) |