爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4915|回复: 8

[讨论] 怎么解读M-K趋势检验

[复制链接]

新浪微博达人勋

发表于 2017-4-9 19:27:00 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
如图所示,根据家园的代码运行出来的结果,但是不懂看,哪位大神帮忙解读?会不会错了?结果是出图还是出表?非常感谢!
QQ截图20170409193159.jpg
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-4-9 20:21:04 | 显示全部楼层
关注一下
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2017-4-9 20:21:07 | 显示全部楼层
关注一下
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2017-4-9 21:03:12 | 显示全部楼层
不应该是看代码里有没有绘图吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-4-10 08:17:34 | 显示全部楼层
代码是从论坛下载的,就改了数据源,请问成图的代码是?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-4-10 09:10:45 | 显示全部楼层
这是数据吧
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-4-10 09:31:46 | 显示全部楼层
什么问题呢?你贴这个图人家也不知道是干嘛啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-4-10 15:19:09 | 显示全部楼层
Angelfish 发表于 2017-4-9 21:03
不应该是看代码里有没有绘图吗?

您好,这是代码:
% Time Series Trend Detection Tests
% [ z, sl, lcl, ucl ] = trend( y, dt )
% where z = Mann-Kendall Statistic
% sl = Sen's Slope Estimate
% lcl = Lower Confidence Limit of sl
% ucl = Upper Confidence Limit of sl
% y = Time Series of Data
% dt = Time Interval of Data
%y是待检测数据序列
% function [ z, sl, lcl, ucl ] = mk( y )
y=xlsread('C:\Users\Administrator\2.xlsx');
n = length( y );
dt=1;

% calculate statistic
s = 0;
for k = 1:n-1,
    for j = k+1:n,
        s = s + sign( y(j) - y(k) );
    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
nor = 1.64;
% results
disp( [ ' n = ' num2str( n ) ] );
disp( [ ' Mean Value = ' num2str( mean( y ) ) ] );
disp( [ ' Z statistic = ' num2str( z ) ] );
if abs( z ) < nor,
disp( ' No significant trend' );
z = 0;
elseif z > 0,
disp( ' Upward trend detected' );
else
disp( ' Downward trend detected' );
end;
disp( 'Sens Nonparametric Estimator:' );

% calculate slopes
ndash = n * ( n - 1 ) / 2;
s = zeros( ndash, 1 );
i = 1;
for k = 1:n-1,
for j = k+1:n,
s(i) = ( y(j) - y(k) ) / ( j - k ) / dt;
i = i + 1;
end;
end;

% the estimate
sl = median( s );
disp( [ ' Slope Estimate = ' num2str( sl ) ] );
% variance ( assuming no tied groups )
v = ( n * ( n - 1 ) * ( 2 * n + 5 ) ) / 18;
m1 = fix( ( ndash - nor * sqrt( v ) ) / 2 );
m2 = fix( ( ndash + nor * sqrt( v ) ) / 2 );
s = sort( s );
lcl = s( m1 );
ucl = s( m2 + 1 );
disp( [ ' Lower Confidence Limit = ' ...
num2str( lcl ) ] );
disp( [ ' Upper Confidence Limit = ' ...
num2str( ucl ) ] );
  
能帮忙加上绘图代码吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-6-21 15:49:31 | 显示全部楼层
问题解决了吗
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表