NMRWish TCL Library Procedures
getSimpleMedian: Return the median of values in a list; return value is always an element from the list.

This is one of a series of TCL procedures that provide simple utilities for extracting statistics from a list of numbers. Each one of these procedures take a single argument which is assumed to be a list of valid numbers. Each procedure performs a calculation on the values in the list, and returns a single number from the computed result. The return value will be zero if the input list is empty. Depending on the calculation and the input, the value returned might be an integer or floating point. Therefore, if a particular type of value is required, the return value should be adjusted by the caller.

ProcedureReturn Value
getAbsMaxReturn the Value with the Maximum Absolute Value in the list.
getAbsMinReturn the Value with the Minimum Absolute Value in the list.
getAvgReturn the Average of Values the list.
getMaxReturn the Maximum Value in the list.
getMedianReturn the Median of the list.
getMinReturn the Minimum Value in the list.
getRMSReturn the Root Mean Square (RMS) of the list.
getSimpleMedianReturn the Simple Median of the list.
getStdDevReturn the Standard Deviation of the list.
getSumReturn the Sum of Values in the list.
getSumSqReturn the Sum of Squares of Values in the list.

Notes: The procedure getMedian will return the average of two central values if the input list has an even number of items, while the procedure getSimpleMedian will always return an exact value from the input list.


    % getSum "1 2 3 4"

    % getMedian "1 2 3 4"

    % getSimpleMedian "1 2 3 4"

    % getMax "1 2 3 4"

    % getAbsMax "-1 -2 0 1"

[ Home ] [ NIH ] [ NIDDK ] [ Disclaimer ] [ Copyright ]
last updated: Jul 24, 2011 / Webmaster