RangeFractile - script and chart function
RangeFractile() returns the value that corresponds to the n-th fractile (quantile) of a range of numbers.
RangeFractile(fractile, first_expr[, Expression])
Return data type: numeric
The argument of this function may contain inter-record functions which in themselves return a list of values.
- fractile: A number between 0 and 1 corresponding to the fractile (quantile expressed as a fraction) to be calculated.
- first_expr: The expression or field containing the data to be measured.
- Expression: Optional expressions or fields containing the range of data to be measured.
|RangeFractile (0.24,1,2,4,6)||Returns 1.72|
Example: (using expression)
RangeFractile (0.5, Above(Sum(MyField),0,3))
In this example, the inter-record function Above() contains the optional offset and count arguments. This produces a range of results that can be used as input to the any of the range functions. In this case, Above(Sum(MyField),0,3) returns the values of MyField for the current row and the two rows above. These values provide the input to the RangeFractile() function. So, for the bottom row in the table below, this is the equivalent of RangeFractile(0.5, 3,4,6), that is, calculating the 0.5 fractile for the series 3, 4, and 6. The first two rows in the table below, the number of values in the range is reduced accordingly, where there no rows above the current row. Similar results are produced for other inter-record functions.
Data used in examples:
LOAD * INLINE [
Example: (in table form)
Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.
LOAD recno() as RangeID, RangeFractile(0.5,Field1,Field2,Field3) as MyRangeFrac INLINE [
Field1, Field2, Field3
The resulting table shows the returned values of MyRangeFrac for each of the records in the table.