Quantile

From Catglobe Wiki
Jump to: navigation, search



quantile

Quantiles are points taken at regular intervals from the cumulative distribution function of a random variable. Dividing ordered data into q essentially equal-sized data subsets is the motivation for q-quantiles; the quantiles are the data values marking the boundaries between consecutive subsets. Put another way, the kth q-quantile is the value x such that the probability that a random variables will be less than x is at most k/q and the probability that a random variable will be less than or equal to x is at least k/q. There are q − 1 quantiles, with k an integer satisfying 0 < k < q.

Let N be the number of non-missing values of the sample population, and let x1, x2, ....., xN represent the ordered values of the sample population such that x1 is the smallest value, etc. For the kth q-quantile, let p = k / q.

775.gif

j is the integer part of N.p and g is the fractional part.

Syntax

quantile(dcsColumn, q, k)

Arguments

dcsColumn:  is a numeric dcs column (column whose data type is Number)

q: an integer number from 2 – Max Int32.

k: an integer number. (0 < k < q)

(*)Please note that when q = 100, the algorithm used here will return a value slightly different from what returned by percentile function in Excel.

Example

number n = quantile(C1, 100, 25) where C2 == 1;

print(n); //return quantile value

Availability

Version 5.2