MEDIAN Function

MEDIAN (matrix) ;

The MEDIAN function returns the median value for each column in the $n \times m$ matrix argument. When the number of data points is odd, it returns the middle element from the sorted order. When the number of data points is even, it returns the mean of the middle two elements. Missing values are excluded from the computation. If all values in a column are missing, the return value for that column is missing. An example of the MEDIAN function follows:

x = {1 3,
     2 3,
     4 9,
    10 0};
med = median(x);
print med;

Figure 24.4: Median of Columns

med
3 3