📄 dixon.m
字号:
function d = dixon( x, h )
%dixon to find a outlying observation in
% normal sample
% using dixon's criterion
%
%x observation vector, the size must be
% between 3 and 30.
%
%h=0 if a low observation has been suspected
% outlying
%h=1 if a top observation has been suspected
% outlying
%
% by SHI DAOJI
x = sort ( x );
n = length ( x );
if n >= 31 | n <= 2
n
fprintf('Warning: size of sample must be between 3 and 30');
else
if h==0
if n <= 7
d = ( x ( 2 ) - x ( 1 ) ) / ( x ( n ) - x ( 1 ) );
elseif n <= 10
d = ( x ( 2 ) - x ( 1 ) ) / ( x ( n-1 ) - x ( 1 ) );
elseif n <= 13
d = ( x ( 3 ) - x ( 1 ) ) / ( x ( n-1 ) - x ( 1 ) );
elseif n <= 30
d = ( x ( 3 ) - x ( 1 ) ) / ( x ( n-2 ) - x ( 1 ) );
else n >= 31
print 'warning:'
end
elseif h==1
if n <= 7
d = ( x ( n ) - x ( n-1 ) ) / ( x ( n ) - x ( 1 ) );
elseif n <= 10
d = ( x ( n ) - x ( n-1 ) ) / ( x ( n ) - x ( 2 ) );
elseif n <= 13
d = ( x ( n ) - x ( n-2 ) ) / ( x ( n ) - x ( 2 ) );
else n <= 30
d = ( x ( n ) - x ( n-2 ) ) / ( x ( n ) - x ( 3 ) );
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -