This routine is based on maximising the likelyhood function for
a statistical model in which any of the data points has a
constant probability of being corrupt. A weighted mean is formed
with weights chosen according to the deviation of each data
point from the current estimate of the mean. The weights are
derived from the relative probability of being invalid or
corrupt. A sequence of these iterations converges to a
stationary point in the likelyhood function. The routine
approximates to a k-sigma clipping algorithm for a large number
of points and to a mode estimating algorithm for fewer data
points. Different weighting for each data point are allowed to
accomodate known different intrinsic errors in the input data.
The variance of the input population is determined from the
whole population and a new variance is computed, after the
rejection passes, using the order statistics of a trimmed sample
with the derived weights and initial numbers. Thus the input data
should be ordered (either increasing or decreasing) so that means
which are outliers (due to unstabilities from overly small sigma
clipping) can have their variance properly estimated.