Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: range_with_location - Function Up: mathematics - Module Previous: kurtosis - Function


median - Function



Package utility
Module mathematics


Calculate the median of a set of numbers


Synopsis
median(dots, is_sorted)



Description
The median of a set of "n" numbers is the middle value (after the values are sorted) if n is odd, or the average of the middle two numbers if n is even. The median is less subject to wild points than is the average - sometimes it is called a more "robust" statistic.

median is implemented the obvious way entirely in Glish, i.e. it sorts the values. More efficient implementations are possible if this turns out to be too inefficient (submit a gnat if you discover this to be true).

If is_sorted is set to T, the sorting is skipped for efficiency, but the results are undefined if the values are not actually sorted.



Arguments

dots   The numbers to perform statistics on
is_sorted   Set if the values are already sorted
    Allowed: T/F
    Default: F


Returns
the median


Example
- include "statistics.g"
+ median(1:100)
50.5



See Also
moments, average





next up previous contents index
Next: range_with_location - Function Up: mathematics - Module Previous: kurtosis - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15