File Exchange

image thumbnail

Seasonal Kendall Test with Slope for Serial Dependent Data

version (13.1 KB) by Jeff Burkey
Seasonal trends using tau-a,b and seasonal slope with intervals, accounts for serial dependence.


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.

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
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.

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

Cite As

Jeff Burkey (2021). 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!