- 积分
- 37
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-8-5
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 投入使用 于 2019-11-9 21:37 编辑
%Mann-kendall趋势检验
clc;
clear;
xx=xlsread(''); %读取列数据
x=xx';
[m,n]=size(x);
s=0;
for i=1:n-1,
for j=i+1:n,
s=s+sign(x(j)-x(i));
end
end
% variance ( assuming no tied groups )
v=(n*(n-1)*(2*n+5))/18;
% test statistic
if s == 0,
z = 0;
elseif s > 0,
z =(s -1)/sqrt(v);
else
z = (s+1)/sqrt(v);
end;
% should calculate Normal value here 显著性水平为5%
nor = 1.96;
% results
disp( [ ' n = ' num2str( n ) ] );
disp( [ ' Mean Value = ' num2str( mean( x ) ) ] );
disp( [ ' Z statistic = ' num2str( z ) ] );
if abs( z ) < nor,
disp( ' No' );
elseif z > 0,
disp( ' Upward ' );
else
disp( ' Downward' );
end;
|
-
-
MK.m
928 Bytes, 下载次数: 5, 下载积分: 金钱 -5
|