通常在做线性倾斜估计时,多用线性回归最小二乘法去拟合并用student-t检验。但利用MK趋势分析(python有pymannkendall包,NCL有trend_manken函数)进行趋势检验时,默认采用的是泰尔-森估算,而并非最小二乘法。当数据存在异常值时,二者差异较大.泰尔-森估算(Theil–Sen estimator)是非参数统计中一种拟合直线的稳健模型,对异常值不敏感,它比非鲁棒简单线性回归明显更准确。
MK趋势检验:
python:
pyMannkendal 是非参数 Mann-Kendall 趋势分析的纯 Python 实现,它汇集了几乎所有类型的 Mann-Kendall Test。目前,这个包有 11 个 Mann-Kendall 检验和 2 个 sen 的斜率估计器函数。
pyMK中代码不适用于新版numpy:修改源码
DeprecationWarning: np.float is a deprecated alias for the builtin float. To silence this warning, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here.
把错误那行代码里面的np.float(…) 改成np.float64(…)
NCL:
trend_manken
最小二乘和泰尔-森趋势的区别: