idlastro / Robust Statistics procedures: ROBUST_SIGMA

[Source code]

NAME
ROBUST_SIGMA  
PURPOSE
Calculate a resistant estimate of the dispersion of a distribution.
EXPLANATION
For an uncontaminated distribution, this is identical to the standard
deviation.
CALLING SEQUENCE
result = ROBUST_SIGMA( Y, [ /ZERO, GOODVEC = ] )
INPUT
Y = Vector of quantity for which the dispersion is to be calculated
OPTIONAL INPUT KEYWORD
/ZERO - if set, the dispersion is calculated w.r.t. 0.0 rather than the
        central value of the vector. If Y is a vector of residuals, this
        should be set.
OPTIONAL OUPTUT KEYWORD
GOODVEC = Vector of non-trimmed indices of the input vector
OUTPUT
ROBUST_SIGMA returns the dispersion. In case of failure, returns 
value of -1.0
PROCEDURE
Use the median absolute deviation as the initial estimate, then weight 
points using Tukey's Biweight. See, for example, "Understanding Robust
and Exploratory Data Analysis," by Hoaglin, Mosteller and Tukey, John
Wiley & Sons, 1983, or equation 9 in Beers et al. (1990, AJ, 100, 32)
REVSION HISTORY
H. Freudenreich, STX, 8/90
eplace MED() call with MEDIAN(/EVEN)  W. Landsman   December 2001
on't count NaN values  W.Landsman  June 2010