[M] = smoothmedian (x)
[M] = smoothmedian (x, dim)
[M] = smoothmedian (x, dim, Tol)
If x is a vector, find the univariate smoothed median (M) of x.
If x is a matrix, compute the univariate smoothed median value for each column and return them in a row vector. If the optional argument dim is given, operate along this dimension. Arrays of more than two dimensions are not currently supported. Data (x) values that are equal to NaN are ignored.
The smoothed median is a slightly smoothed version of the ordinary median and is an M-estimator that is both robust and efficient, where it's breakdown point, and efficiency relative to the mean, are 0.341 amd 0.865 respectively.
Smoothing the median is achieved by minimizing the following objective function:
S (M) = sum ((x(i) - M).^2 + (x(j) - M).^2) .^ 0.5
i < j
where i and j refers to the indices of the Cartesian product of each column of x with itself.
With the ordinary median as the initial value of M, this function minimizes the above objective function by finding the root of the first derivative using a fast, but reliable, Newton-Bisection hybrid algorithm. The tolerance (Tol) is the maximum value of the first derivative that is acceptable to break from optimization. The default value of Tol is 1e-03.
The smoothing works by slightly reducing the breakdown point of the median. Bootstrap confidence intervals using the smoothed median have good coverage for the ordinary median of the population distribution and can be used to obtain second order accurate intervals with Studentized bootstrap and calibrated percentile bootstrap methods . When the population distribution is thought to be strongly skewed, coverage errors can be reduced by improving symmetry through appropriate data transformation. Unlike kernel-based smoothing approaches, bootstrapping smoothmedian does not require explicit choice of a smoothing parameter or a probability density function.
 Brown, Hall and Young (2001) The smoothed median and the bootstrap. Biometrika 88(2):519-534