Compare Measures of Dispersion
This example shows how to compute and compare measures of dispersion for sample data that contains one outlier.
Generate sample data that contains one outlier value.
x = [ones(1,6),100]
x = 1 1 1 1 1 1 100
Compute the interquartile range, mean absolute deviation, range, and standard deviation of the sample data.
stats = [iqr(x),mad(x),range(x),std(x)]
stats = 0 24.2449 99.0000 37.4185
The interquartile range (iqr) is the difference between the 75th and 25th percentile of the sample data, and is robust to outliers. The range (range) is the difference between the maximum and minimum values in the data, and is strongly influenced by the presence of an outlier.
Both the mean absolute deviation (mad) and the standard deviation (std) are sensitive to outliers. However, the mean absolute deviation is less sensitive than the standard deviation.