Seasonal Kendall Test with Slope for Serial Dependent Data

Seasonal trends using tau-a,b and seasonal slope with intervals, accounts for serial dependence.
4.9K Downloads
Updated 21 Feb 2012

View License

Seasonal Kendall Trend Test for Data with and without Searial Dependance.

Tau-b seasonal: takes into account ties (and multiple observations, except, the data are preprocessed in a subfucntion and multiple observatiosn per a given season are averaged using median).

Tau-a seasonal: does not consider multiple observations per season as ties. The data are preprocessed, seasons with multiple observations are summarized with a median value.

This routine will take into data evenly spaced by seasons. Compute Seasonal Tau-b, Tau, Sen's slope and it's confidence intervals.

Accounting for Serial Correlation is based on the below paper:
Hirsch, R. M., Slack, J. R., A Nonparametric Trend Test for Seasonal Data with Serial Dependence. Water Resources Research Vol 20, No. 6, pages 727-732, June 1984.

Modifications:
12/13/2008 - added Homogeneity test of trends for different seasons.
12/17/2008 - added adjustments to significance with serial
correlations removed by computing covariance instead of assuming zero.
Starting season can be users specified.
12/18/2008 - mulitiple observations in a single season are median averaged.
1/17/2009 - checks for anomalies and provides solutions and/or
notifications. Also requires the updated ktaub.m file
because of the need for a computed variance with no ies
removed.
2/2/2009 - modified comments in this file
2/21/2012 - when there were multiple values within the same season,
the seasonAverage subroutine wasn't storing the averaged data
correctly. Fixed in this revision. Thank you to Juan Carlos for pointing
this out!

Dependencies: ktaub.m
Statistics Toolbox

This function does require ktaub.m which has also been revised to support this function, so if you've previously downloaded ktuab.m, please check to make sure you have the most recent version.

Note: Calculating the covariance depends on when your seasons start in the year. For example, the USGS program Kendall.exe will automatically assume that Season 1 is the start of a water year (i.e. Season 1 = October, Season 12 = September). True that the 1984 Hirsch paper is dervied using 12-seasons (i.e. months), it is certainly reasonable to assume that the number of seasons can be something other than 12 months, and not necessariliy starting in October. So this function allows for the user to specify when Season 1 is to start. This nuance is critical because incomplete years are filled in with mid-ranks in the covariance.

These seasonal statistics were inspired by: Richard O. Gilbert, Pacific Northwest National Laboratories, "Statistical methods for Environmental Pollution Monitoring", 1987, Van Nostrand Reinhold, New York Publishing, ISBN 0-442-23050-8.

A good supporting statistic that may prove useful is performing a global trend test evaluating homogeneity of trends for different stations and seasons.
See the posted function namged: GlobalTrends.m
datain structure is assumed to vary as the following:
datain(:,1) = Time (e.g. year)
datain(:,2) = season
datain(:,3) = data
alpha = assumed level of confidence
wantplot = flag if ~= 0 then a figure will be created if Tau-b is
significant. StartSeason = shift seasons to start with this one.
Example: StartSeason = 10 will shift seasons 10 = 1, then years are adjusted to start with the new season shift.

Syntax:
[taubsea tausea Sens h sig sigAdj Zs Zmod Ss Sigmas CIlower CIupper]
= sktt(datain,alpha,wantplot,StartSeason)

Cite As

Jeff Burkey (2024). Seasonal Kendall Test with Slope for Serial Dependent Data (https://www.mathworks.com/matlabcentral/fileexchange/22389-seasonal-kendall-test-with-slope-for-serial-dependent-data), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.9.0.0

A bug was reported by Juan Carlos in the averaging of seasons causing the function to crash. It has been fixed. Thanks Juan for pointing this out! I also cleaned up some of the comments.

1.8.0.0

I've gotten a couple of inquiries asking for example dataset to use. I've included a MAT file that can be used with the m-file.

1.7.0.0

Updated comments in the m-file.

1.6.0.0

Now will test for anomalies in trend estimates. Fixes and notifies the user. See comments in function for more detail and the paper used for this enhancement. This update also requires the updated ktaub.m function 1/17/2009.

1.5.0.0

I noticed I had left in some hard code of the startSeasons function. Fixed to be dynamic.

1.4.0.0

Now includes calculation of the covariance to account for serial dependence of data.

1.1.0.0

I had an error in the plotting routine. It's fixed.

1.0.0.0