DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


Percentile

Declaration: TMatrix.Percentile (prob: double; LowCol, LowRow, HighCol, HighRow: integer; SampleSize: integer): double;
The function Percentile returns the percentile with the probability of prob percent. The calculation of the percentile is based on all matrix elements between (and including) LowCol, LowRow, HighCol and HighRow. The function returns a zero value if any error occurs.

The function Percentile performs an exact calculation if the parameter SampleSize is zero, otherwise it calculates the percentile of a random sample taken from the specified data range. The size of the random sample is controlled by the parameter SampleSize. If SampleSize is larger than the number of elements in the specified data range, oversampling occurs (which does no harm to the result but is slower). The big advantage of the approximation via sampling is its much faster execution. Downsampling should be used if the number of specified elements exceeds 50000 cells (using a sample size of 10000).

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

Hint 1: Setting both the low and high parameter of a dimension (i.e. LowCol and HighCol) to zero values forces the method to use all elements of that dimension.

Hint 2: The calculated percentile is not interpolated and simply returns the closest value of the distribution, which may differ from other statistical packages and from the results obtained by TVector.Percentile if the number of included values is low.