The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Unit: SDL_statis
Class: none
Declaration: function PercentileOfArray (Data: TDoubleArray; prob: double; FirstIx, LastIx: integer; var Percentile: double): integer;

The function PercentileOfArray returns the percentile with the probability of prob percent. The calculation of the percentile is based on the distribution of all cells of the array Data between (and including) FirstIx, and LastIx. The calculated percentile is returned in the variable parameter Percentile.

The function returns the following error codes:

 0 ... everything is OK, returned percentile is valid
-1 ... FirstIx and/or LastIx is out of range
-2 ... Prob is out of range
-3 ... FirstIx is greater than LastIx

Please note that the 50%-percentile (prob = 50) is also known as the median of the distribution.

Last Update: 2016-Aug-15