./
medabsdev.pro
Routines
result = medabsdev(data [, sigma=sigma] [, median=median] [, even=even])This function returns a data set's median absolute deviation from the median.
test
Routine details
topmedabsdev
Statistics
result = medabsdev(data [, sigma=sigma] [, median=median] [, even=even])
This function returns a data set's median absolute deviation from the median. That is, it returns median( |data - median(data) | ) It is a proxy for the standard deviation, but is more resistent against outliers.
Return value
median( |data - median(data)| )
NOTE: For the gaussian distribution, medabsdev / sigma = inverseErf(0.5) * sqrt(2) = 0.67449
EXAMPLES: IDL> dist = randomn(seed, 50) IDL> outlier = 1d7 IDL> data = [dist, outlier] IDL> print, stdev(dist), stdev(data) 1.09757 1400280.1 IDL> print, medabsdev(dist), medabsdev(data) 0.597564 0.59756410
Parameters
- data in required
An array of data
Keywords
- sigma in optional
If set, divide the median absolute deviation by inverseErf(0.5) * sqrt(2). This scales the MAD to an approximation for sigma (assuming a Gaussian distribution)
- median in optional
On output, holds the median of the data
- even in optional
If set and data contains an even number of points, medians are computed as the average of the two middle numbers. The returned values may not be an element of the original data.
Author information
- History:
Aug 2009: Written by Chris Beaumont Sep 2009: Added /SIGMA keyword. cnb. Oct 2009: Added input checking. cnb. Oct 2010: Added median keyword. cnb. Jul 2012: Added /even keyword. Julio Castro
toptest
test
File attributes
| Modifcation date: | Thu Jul 26 15:20:33 2012 |
| Lines: | 82 |
![[attach.png]](idldoc-resources/attach.png)