mad
Mean or median absolute deviation
Description
returns the mean absolute deviation of the values iny
= mad(X
)X
.
If
X
is a vector, thenmad
returns the mean or median absolute deviation of the values inX
.If
X
is a matrix, thenmad
returns a row vector containing the mean or median absolute deviation of each column ofX
.If
X
is a multidimensional array, thenmad
operates along the first nonsingleton dimension ofX
.
returns the mean or median absolute deviation over the dimensions specified in the vectory
= mad(X
,flag
,vecdim
)vecdim
. For example, ifX
is a 2-by-3-by-4 array, thenmad(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 ofX
.
Examples
Input Arguments
Output Arguments
Tips
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 deviationsigma = 1.4826 * mad(X,1)
— For median absolute deviation
References
[1] Mosteller, F。,j .图基。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.