Main Content

Mean or median absolute deviation

returns the
mean absolute deviation of the values in `y`

= mad(`X`

)`X`

.

If

`X`

is a vector, then`mad`

returns the mean or median absolute deviation of the values in`X`

.If

`X`

is a matrix, then`mad`

returns a row vector containing the mean or median absolute deviation of each column of`X`

.If

`X`

is a multidimensional array, then`mad`

operates along the first nonsingleton dimension of`X`

.

returns the mean or median absolute deviation over the dimensions specified in the vector
`y`

= mad(`X`

,`flag`

,`vecdim`

)`vecdim`

. For example, if `X`

is a 2-by-3-by-4 array,
then `mad(X,0,[1 2])`

returns a 1-by-1-by-4 array. Each element of the
output array is the mean absolute deviation of the elements on the corresponding page of
`X`

.

For normally distributed data, multiply

`mad`

by one of the following factors to obtain an estimate of the normal scale parameter*σ*:`sigma = 1.253 * mad(X,0)`

— For mean absolute deviation`sigma = 1.4826 * mad(X,1)`

— For median absolute deviation

[1] Mosteller, F., and J. Tukey. *Data Analysis and
Regression*. Upper Saddle River, NJ: Addison-Wesley, 1977.

[2] Sachs, L. *Applied Statistics: A Handbook of
Techniques*. New York: Springer-Verlag, 1984, p. 253.