Quantile (FPScript)

21.09.2021

Determines individual, floating or block mean quantiles for a data set.

Syntax

Quantile(DataSet, Alpha, [ Mode = PROCESS_COLUMNS ] [ , IntervalWidth ])

 

The syntax of the Quantile function consists of the following parts:

Part

Description

DataSet

The data set to be evaluated.

All data structures are allowed. All numeric data types are permitted.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Alpha

Specifies the parameter for determining the quantile.

Permitted data structures are scalar value. All numeric data types are permitted.

The value must be greater or equal to 0 and less or equal to 1.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Mode

Specifies how data matrices and signal series are to be processed and whether individual, floating or block quantiles are to be determined. If you omit the argument, individual quantiles are determined column by column.

The argument Mode can have the following values:

Constant

Meaning

PROCESS_COLUMNS

Data matrices and signal series are processed column by column. The result is a data series or a signal with one quantile per column.

PROCESS_ROWS

Data matrices and signal series are processed row by row. The result is a data series or signal with one quantile per row.

PROCESS_COMPLETE

Data matrices and signal series are processed as a whole. The result is a scalar value with a quantile for the entire data set.

...plus an optional constant, which determines the calculation method:

Constant

Meaning

+ CALC_BLOCK

Block-by-block calculation. One value is calculated per interval.

+ CALC_MOVING

Moving calculation. For every value in the data set, a result is determined in the specified interval.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value PROCESS_COLUMNS.

IntervalWidth

This argument is required for determining floating and block quantiles. The interval width then specifies the number of values to be examined. The width should be an odd number. Otherwise, the interval is asymmetrical, and one more value is included in the calculation to the right of the center as opposed to the left.

Permitted data structures are scalar value. All integral data types are permitted.

The value must be greater or equal to 1.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Remarks

To determine the Alpha quantile, the sample is sorted and then the value at the position Alpha * NumberOfRows(DataSet) is taken.

If Alpha specifies a position that lies between two neighboring values (e.g. even number of values and Alpha = 0.5), then linear interpolation takes place between the values. Specific terms are used for the following Alpha values:

Value of Alpha

Interpretation

0.25

Lower quartile

0.5

Median

0.75

Upper quartile

A scalar value is returned without modification. For signals and signal series, the Y component is processed and the X or Z component is copied, if possible. When calculating floating and block quantiles, the data structure of the result corresponds to that of the argument. If, on the other hand, DataSet is a data series or a signal, the result is a scalar value with the quantiles searched for. Otherwise, the result is a data series or a signal with one quantile per column or row.

The calendar time and time span data types remain in the result. For all other numeric data types, the result is of the 64-bit floating point value type.

Note        The Quantile function is suited for realizing a median filter. Here, you use the function with Alpha = 0.5 and in CALC_MOVING mode. A signal is smoothed with a median filter similarly to a floating mean, but responds better to signals with outliers. Individual outliers greatly influence the mean, but have little influence on the median. The following illustrates the differences:

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Quantile({2, 5, 7, 1, 3}, 0.5)

Results in 3. (the median)

Quantile(Signal, 0.5, CALC_MOVING, 10)

Median filtering using a smoothing width of 10.

See Also

Mean Function

Statistical Quantity Analysis Object

Signal Smoothing Analysis Object

Share article or send as email:

You might be interested in these articles