曼·肯德尔<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />大家好。 我正在尝试运行曼肯德尔来测试时间趋势是否显着。 在 JMP 手册或任何在线内容中都找不到它。 有人有主意吗?
谢谢!
曼·肯德尔谢谢女士和戴夫! 我不确定 Kendall 的 Tau 和 Mann-Kendall 测试是否相同(和/或相关)。 感谢您提供有关多变量测试的信息以及脚本!
曼·肯德尔即使 Mann-Kendall 检验统计量和 Kendall Tau b 的定义经常用不同的术语描述(分别从时间序列和相关性角度),但据我所知,它们本质上是相同的。
下面是我很久以前写的一个脚本。 它计算并显示泰尔斜率并执行曼-肯德尔检验。 图中显示参数线性回归线仅供比较。 我计划通过包含“By”函数以及解释季节性模式的可能性来概括该脚本。 但我还没有时间去实现这些计划。 我希望这能给你一些想法。
dt =当前数据表() ;
dlg =列对话框(
“根据数据表估计 Theil 斜率和 Kendall Tau” ||
查尔( dt <<得到名字) ,
伊苏=列列表( “选择Y” ,
麦克斯科尔( 1 ) ,
明科尔( 1 ) ,
数据类型(数字)
) ,
Xs =列列表( “选择X” ,
麦克斯科尔( 1 ) ,
明科尔( 1 ) ,
数据类型(数字)
) ,
团体=列列表( “通过(不工作)” ,麦克斯科尔( 1 ) )
) ;
科利=柱子( dt , dlg [ “是” ] ) ;
列X =柱子( dt , dlg [ “×” ] ) ;
colGroup =柱子( dt , dlg [ “团体” ] ) ;
//泰尔斜率的计算
n = N 行( dt ) ;
连续下坡= J ( n , n , 。 ) ;
为了(我= 1 ,我< n ,我++,
为了( j =我+ 1 , j <= n , j ++,
连续下坡[我, j ] = (科利[ j ] -科利[我]) / (列X [ j ] -列X [我])
)
) ;
泰尔=分位数( 0.5 ,连续下坡) ;
//Kendall 的 Tau b 测试斜率是否不同于零
MV =多变量(
是(科利,列X ) ,
散点图矩阵( 0 ) ,
多元相关性( 0 ) ,
肯德尔的头( 1 )
) ;
//绘制数据并添加线性回归和泰尔斜率
BIV =双变量(
是(科利) ,
X (列X ) ,
拟合线( {线条颜色( “红色的” )} ) ,
特别适合(坡(泰尔) , {线条颜色( “绿色的” )} ) ,
无形的
) ;
重组病毒= BIV <<报告;
重组病毒[ “线性拟合” ] <<像这样关闭所有;
重组病毒[轮廓盒( 7 )] <<设置标题( 《泰尔斜坡》 ) ;
D b =报告( MV )[ “多元” ] <<家长;
D b <<前置(重组病毒) ;
D b [文本框( 4 )] <<设置文本( 《泰尔斜坡》 ) ;
重组病毒<<关闭窗口;
回复:曼·肯德尔我不确定 Mann-Kendall 检验与非参数相关性的 Kendall Tau 统计量的相关程度(如果有的话)。后者可以在多变量平台下访问:分析>多变量方法,然后从多变量报告中选择热点中的非参数相关性。
如果测试完全不同,我会对您对此方法的任何参考感兴趣。我正在考虑构建一个插件来实现为水文学领域开发的多种方法(例如赫斯特指数)
问候
戴夫
回复:曼恩·肯德尔你好,这是对此脚本的更新,它涵盖了使用大类示例指定按角色(有 2 个级别)中的列的情况。
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dlg = Column Dialog(
"Estimate Theil slope and Kendall Tau from Data Table " ||
Char( dt << get name ),
Ys = ColList( "Select Y",
maxcol( 1 ),
mincol( 1 ),
Datatype( numeric )
),
Xs = ColList( "Select X",
maxcol( 1 ),
mincol( 1 ),
Datatype( numeric )
),
Group = ColList( "By", maxcol( 1 ) )
);
colY = Column( dt, dlg["Ys"] );
colX = Column( dt, dlg["Xs"] );
colGroup = Column( dt, dlg["Group"] );
//create subset data tables when By Role is used
subdt = dt << Subset(
By( :sex ),
All rows,
Selected columns only( 0 ),
);
//hide subset data tables, for 2 levels of the Group column in the By Role
subdt[1] << Show Window(0);
subdt[2] << Show Window(0);
//Calculation of Theil-Sen slope: A robust non-parametric estimate of trend magnitude.
theil = {}; //create empty list call 'theil'to store Theil-Sen slopes
for (k = 1, k <= Nitems(subdt), k++,
curY = Column( subdt[k], dlg["Ys"] );
curX = Column( subdt[k], dlg["Xs"] );
n = N Rows( subdt[k] );
slopes = J( n, n, . ); //this is initialized not as an empty matrix but it's full of missing values
For( i = 1, i < n, i++,
For( j = i+1, j <= n, j++,
slopes[i, j] = (curY[j] - curY[i]) / (curX[j] - curX[i])
)
);
insert into(theil, Quantile( 0.5, slopes )); //calculate the median of all the slopes
);
new window("windowname",
/*Kendall's Tau b to test if slope differs from zero. Analogous to the Mann-Kendall significance test, which Outputs the S statistic and p-value.*/
mv = dt << Multivariate(
Y( colY, colX ),
Scatterplot Matrix( 0 ),
Correlations multivariate( 0 ),
Kendall's Tau( 1 ), /*see above*/
By(colGroup)
);
//Plot data and add linear regression and Theil's slope
biv = dt << Bivariate(
Y( colY ),
X( colX ),
By(colGroup),
Fit Line( {Line Color( "Red" )} ),
//invisible
);
);
//Plot Theil's Slopes using Fit special in Bivariate report
biv[1] << Fit Special( Slope( theil[1] ), {Line Color( "Green" )});
biv[2] << Fit Special( Slope( theil[2] ), {Line Color( "Green" )});
rbiv = biv << Report;
rbiv[1]["Linear Fit"] << close all like this;
//all of the second linear fit outline boxes under an outline box that contains the word "sex" in the title is what I want
tsb = rbiv << Xpath("(//OutlineBox[text()='Linear Fit'])[2]"); //this returns the list of display boxes titled "Linear Fit" that I want to change to "Thiel's slope" and then I am capturing this reference with the variable name tsb
tsb << set title( "Theil's Slope" );