The MEANABSDEV function computes the mean absolute deviation of an n-element vector or array.

This routine is written in the IDL language. Its source code can be found in the file meanabsdev.pro in the lib subdirectory of the IDL distribution.

Examples


; Define an n-element vector:
x = [1, 1, 1, 2, 5]
; Compute average deviation from the mean:
result = MEANABSDEV(x)
; Print the result:
PRINT, result

IDL prints:

1.20000

Syntax


Result = MEANABSDEV( X [, /DOUBLE] [, /MEDIAN] [, /NAN] )

Return Value


Returns the average deviation.

Arguments


X

An n-element vector or array of any numeric type.

Keywords


DOUBLE

Set this keyword to force computations to be done in double precision arithmetic and to return a double precision result. If this keyword is not set, the computations and result depend upon the type of the input data (integer and float data return float results, while double data returns double results). This has no effect if the MEDIAN keyword is set.

MEDIAN

Set this keyword to return the average deviation from the median. By default, if MEDIAN is not set, MEANABSDEV will return the average deviation from the mean.

NAN

Set this keyword to cause the routine to check for occurrences of the IEEE floating-point values NaN or Infinity in the input data. Elements with the value NaN or Infinity are treated as missing data.

Version History


5.1

Introduced

See Also


KURTOSIS, MEAN, MOMENT, STDDEV, SKEWNESS, VARIANCE