smoothmedian (x, dim, Tol)

バージョン 1.8.1.1 (294 KB) 作成者: Andrew Penn
A smooth version of the median
ダウンロード: 201
更新 2022/10/23

ライセンスの表示

[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 [1]. 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.
This function is already included in the statistics-bootstrap package (https://uk.mathworks.com/matlabcentral/fileexchange/52741-statistics-bootstrap).
Bibliography:
[1] Brown, Hall and Young (2001) The smoothed median and the bootstrap. Biometrika 88(2):519-534

引用

Andrew Penn (2024). smoothmedian (x, dim, Tol) (https://www.mathworks.com/matlabcentral/fileexchange/52737-smoothmedian-x-dim-tol), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R2022a
R13SP1 以降のリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersDescriptive Statistics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

smoothmedian

バージョン 公開済み リリース ノート
1.8.1.1

Updated/corrected the description to match the new handling of NaN values

1.8.1

New version ignores NaN values rather than throws an error. Only the source code and compiled MEX function files are now provided.

1.8.0.4

Added info to the description about the function not tolerating NaN or Inf values

1.8.0.3

Added note to the description

1.8.0.2

Minor performance enhancement

1.8.0.1

Corrected description on the Mathworks site

1.8.0.0

Major performance enhancement. Includes MEX files and C++ source code.

1.7.3.0

Minor performance enhancement

1.7.2.0

Minor bug fix

1.7.0.0

Added calculation of standard errors

1.4.2.0

Minor changes to documentation only

1.4.1.0

Minor changes to documentation only

1.4.0.0

Inf and NaN values in x no longer cause root finding to loop upto the maximum number of iterations. Now, where Inf and NaN values are encountered, nanmedian (or median) is used instead.

1.3.0.0

No changes to the function. Added a figure to the description.
Changed conjugate transpose to non-conjugate transpose for dim = 2

1.2.1.0

Minor changes to the documentation
Corrected version number in file

1.2.0.0

Now checks the dimensions of x

1.1.0.0

Modified the variable transformation to one more suitable for computing a location parameter.

1.0.0.0

Simplified title on file exchange webpage.