mad#

swordfish.function.mad()#

If X is a vector, return the average absolute deviation of X.

If X is a matrix, the calculation is based on each column and returns a matrix.

If X is a table, the calculation is based on each column and returns a table.

As with all aggregate functions, null values are not included in the calculation.

Parameters:
  • X (Constant) – A vector, matrix or table.

  • useMedian (Constant) –

    A Boolean value indicating whether the result is generated with the median absolute deviation or the mean absolute deviation. The default value is false and it returns the mean absolute deviation.

    • Mean Absolute Deviation: mean(abs(X - mean(X)))

    • Median Absolute Deviation: med(abs(X - med(X)))