原理后续补充
theil-sen trend analysis from sklearn.linear_model import TheilSenRegressor Theil-Sen trend analysis有无截距计算的差异
no intercept–>fit_intercept=False intercept–>fit_intercept=True
MK检验 The Mann-Kendall Trend Test (sometimes called the MK test) is used to analyze time series data for consistently increasing or decreasing trends (monotonic trends). It is a non-parametric test, which means it works for all distributions (i.e. data doesn’t have to meet the assumption of normality), but data should have no serial correlation. If the data has a serial correlation, it could affect in significant level (p-value). It could lead to misinterpretation. To overcome this problem, researchers proposed several modified Mann-Kendall tests (Hamed and Rao Modified MK Test, Yue and Wang Modified MK Test, Modified MK test using Pre-Whitening method, etc.). Seasonal Mann-Kendall test also developed to remove the effect of seasonality.
pymannkendall 1.4.1
import numpy as np import pymannkendall as mk # Data generation for analysis data = np.random.rand(360,1) result = mk.original_test(data) print(result)结果
Mann_Kendall_Test(trend='no trend', h=False, p=0.9507221701045581, z=0.06179991635055463, Tau=0.0021974620860414733, s=142.0, var_s=5205500.0, slope=1.0353584906597959e-05, intercept=0.5232692553379981)