AbsoluteDeviationFromMean (FPScript)
Determines the mean absolute deviation from the mean value of a data set. The displacements from the mean are determined for all values of the data set and the average is calculated from these.
Syntax
AbsoluteDeviationFromMean(DataSet, [ Mode = PROCESS_ROWS ] [ , IntervalWidth ])
The syntax of the AbsoluteDeviationFromMean 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 mean. 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 mean, 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
AbsoluteDeviationFromMean({1,4,7}) |
Results in 2.0. The mean value of the data series is 4. The first and third value each deviate by 3 from the mean value. The result is thus calculated from (3 + 0 + 3) / 3. |
AbsoluteDeviationFromMean({{1, 4, 7}, {1, 4, 7}}) |
Results in {0.0, 0.0, 0.0}. From the matrix, the function calculates row-by-row the mean absolute deviation from the mean value. |
AbsoluteDeviationFromMean({{1, 4, 7}, {1, 4, 7}}, PROCESS_COLUMNS) |
Results in {2.0, 2.0}. From the matrix, the function calculates column-by-column the mean absolute deviation from the mean value. |
AbsoluteDeviationFromMean({1, 2, 3, 2, 1}, CALC_MOVING, 3) |
Results in { 0.5, 0.6666666666666666, 0.4444444444444445, 0.6666666666666666, 0.5 }. The function calculates the moving mean absolute deviation from the mean value for {1, 2}, {1, 2, 3}, {2, 3, 2}, {3, 2, 1} and {2, 1}. |
AbsoluteDeviationFromMean({1, 2, 3, 4, 4.5, 5}, CALC_BLOCK, 3) |
Results in { 0.6666666666666666, 0.3333333333333333 }. The function calculates the mean absolute deviation from the mean value block by block for {1, 2, 3} and {4, 4.5, 5}. |