fractrimmean

Fractional trimmed mean.
ダウンロード: 296
更新 2011/9/20

ライセンスの表示

Calculates the M fractional trimmed mean (truncated mean) of the values in X. Excluding the highest and lowest PERCENT/2 (%) of the data. It is an advanced trimming method. Given a sample of n ordered observations x_(1) <= x_(2) <= ... <= x_(n), the trimmed mean is a specific example of weighted mean or L-estimator of location. It will apply zero weights in the extremes of the sample and positive weights in the center. This weighting scheme is reasonable when the underlying distribution is symmetric but the sample from it may be contaminated by outliers who can bias the averaging. So, it is robust to the effects of outliers and with small variance.

Not to be wrong. It is necessary to be careful in distinguishing between the PERCENT of both sides of the sample distribution and the TRIMMED PERCENT, which is PERCENT/2.

Thus, a trimmed mean is calculated by discarding a certain percentage of the lowest and the highest scores and then computing the mean of the remaining scores. The median is the mean trimmed 100 and the arithmetic mean is the mean trimmed 0. Obviously, it is less susceptible to the effects of extreme scores than is the arithmetic mean.

As Horn and Kafadar (2002) stated. A trimmed mean requires a prespecified proportion of deleted observations, say p, often stated as a percentage. The p-trimmed mean is defined as,

T(p) = ((1 - r)(x_(g+1) + x_(n-g)) + i=g+2_S_n-g-1 x_(i))/n(1 - 2p)

where g=[np] and r=np - g, the integer and fractional remainder parts of the product of n and p, respectively. S is the sum operator. If p*n is an integer, then r=0 and there are no partially weighted extreme values. The denominator part n(1 - 2p) is the retained number of observations after trimming p() on each side. Then,

T(p) = (i=g+1_S_n-g x_(i))/(n(1 - 2p))

Thus, as in Lim and Loh (1996, p.292), the 20 fractional trimmed mean (40%) at n=4 is, with g=[4*0.2]=[0.8]=0.0 and r=0.8-0.0=0.8:

T(0.2) = ((1 - 0.8)(x_(0.0+1) + x_(4-0.0)) + i=0.0+2_S_4-0.0-1 x_(i))/4(1-2*0.2)
= ((0.2)(x_(1) + x_(4)) + i=2_S_3 x_(i))/4(0.6)
= ((0.2)(x_(1) + x_(4)) + (x_(2) + x_(3)))/2.4
= (0.2*x_(1) + x_(2) + x_(3) + 0.2*x_(4))/2.4

at n=5 is, with g=[5*0.2]=[1.0]=1.0 and r=1.0-1.0=0.0:

T(0.2) = (i=1+1_S_5-1 x_(i))/(5(1 - 2*0.2))
= (i=2_S_4 x_(i))/(5(1-0.4))
= (i=2_S_4 x_(i))/5(0.6)
= (i=2_S_4 x_(i))/3
= (x_(2) + x_(3) + x_(4))/3

For a matrix input, if required M can be a row vector containing the trimmed mean of each column of X (DIM = 1,default) or a column vector of the trimmed mean of each row of X (DIM = 2). PERCENT is a scalar between 0 and 100.

FRACTRIMMEAN treats NaNs values as missing values, and removes them.

Syntax: function fractrimmean(x,percent,dim)

Inputs:
x – data vector or matrix
percent - scalar between 0 and 100
dim - works along the dimension of X [columns=1(default);rows=2]

Output:
m - trimmed mean

引用

Antonio Trujillo-Ortiz (2024). fractrimmean (https://www.mathworks.com/matlabcentral/fileexchange/32953-fractrimmean), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R14
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersTime Series についてさらに検索

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.1.0.0

It was added an appropriate format to cite this file.

1.0.0.0