How to plot the sen's slope to time series data using Mann-Kendall Test and Sen’s slope estimator

34 ビュー (過去 30 日間)
I want to plot a the sen's slope (linear line) on my time series data, I have already used mann kendall test fuction to see if the trend exist within the data, yes there is trend , but then the next stepis to estimate the sen's slope but I dont understand how this function below really works, please can someone clarify, what is my x and y?
function b = Theil_Sen_Regress(x,y)
[N c]=size(x);
Comb = combnk(1:N,2);
deltay=diff(y(Comb),1,2);
deltax=diff(x(Comb),1,2);
theil=diff(y(Comb),1,2)./diff(x(Comb),1,2);
b=median(theil);

回答 (2 件)

Vishnu Dhakad
Vishnu Dhakad 2021 年 10 月 11 日
Hi,
You can use a code which is available on following link with title 'MATLAB code for the Mann–Kendall test and Sen's slope estimation for time series data'
https://www.researchgate.net/publication/312220507_MATLAB_code_for_the_Mann-Kendall_test_and_Sen's_slope_estimation_for_time_series_data

Matthew Heberger
Matthew Heberger 2023 年 1 月 4 日
As of Jan 2023, this appears to be the best function on the File Exchange for calculating Sen's Slope:
https://fr.mathworks.com/matlabcentral/fileexchange/71205-theil-sen-regression-with-intercept

カテゴリ

Help Center および File ExchangeSpecification Testing についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by