AbsoluteDeviationFromMedian (FPScript)

21.09.2021

Determines the mean absolute deviation from the median of a data set. This is the average of the deviations from the median. The median is the value that lies exactly in the center of a data series after sorting. If the data set contains an even number of values, the average of the two center values is formed.

Syntax

AbsoluteDeviationFromMedian(DataSet, [ Mode = PROCESS_ROWS ] [ , IntervalWidth ])

 

The syntax of the AbsoluteDeviationFromMedian 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.

For complex data types the absolute value is formed.

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

Mode

Specifies how data matrices and signal series are to be processed.

The argument Mode can have the following values:

 

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

IntervalWidth

This argument is required to determine moving and block deviations from the median. 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

The result always has the data type 64-bit floating point.

For signals and signal series, the Y component is processed and the X or Z components are copied, if possible. When calculating moving and block deviations from the median, the data structure of the result corresponds to that of the argument. If DataSet is a data series or a signal, the result is a scalar value with the mean absolute deviation searched for; otherwise, the result is a data series or a signal with one mean absolute deviation per column or row.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

AbsoluteDeviationFromMedian({3, 1, 10})

Results in 3.0. The median of the sorted data series {1, 3, 10} is 3. The first value deviates by 2 from the median, and the third value deviates by 7. The result is thus calculated from (2 + 0 + 7) / 3.

AbsoluteDeviationFromMedian({{3, 1, 10}, {3, 1, 10}})

Results in {0.0, 0.0, 0.0}. From the matrix, the function calculates row-by-row the mean absolute deviation from the median.

AbsoluteDeviationFromMedian({{3, 1, 10}, {3, 1, 10}}, PROCESS_COLUMNS)

Results in {3.0, 3.0}. From the matrix, the function calculates column-by-column the mean absolute deviation from the median.

AbsoluteDeviationFromMedian({1, 7, 3, 2, 5}, CALC_MOVING, 3)

Results in { 3, 2, 1.666666666666667, 1, 1.5 }. The function calculates the moving mean absolute deviation from the median for {1, 7}, {1, 7, 3}, {7, 3, 2}, {3, 2, 5} and {2, 5}.

AbsoluteDeviationFromMedian({1, -1, 3, 7, 4.5, 5}, CALC_BLOCK, 3)

Results in { 1.333333333333333, 0.8333333333333334 }. The function calculates the mean absolute deviation from the median block by block for {1, -1, 3} and {7, 4.5, 5}.

See Also

AbsoluteDeviationFromMean Function

Statistical Quantity Analysis Object

Share article or send as email:

You might be interested in these articles