rkt: Mann Kendall test and Seasonal and Regional Kendall tests...

View source: R/rkt.R

rktR Documentation

Mann Kendall test and Seasonal and Regional Kendall tests (SKT/RKT)

Description

Computes the Mann-Kendall test (MK) and the Seasonal and the Regional Kendall Tests for trend (SKT and RKT) and Theil-Sen's slope estimator.
When a covariable is defined, this function also computes partial RKT and SKT.
To allow for non-regular sampling dates, input data should be vectors, not time series.

Usage

rkt(date, y, block, cv, correct = F, rep = "e", exactp=F, maxp=100)

Arguments

date

a mandatory vector of numerical data representing dates, as years or years+decimal. If correction for intra-block correlation is required, dates will be truncated to the year, and no more than one value per block per year will be considered. If two equal dates (or truncated dates) are found, the behaviour of the program is determined by rep

y

a mandatory vector of measured data. In this vector, missing data are allowed.

block

an optional vector of positive integer numbers representing blocks, i.e. sites, seasons or months, or a code combining both sites and seasons/months. If no blocks are defined, the result will be the Mann-Kendall test.

cv

an optional vector containing a covariable, such as river flow or deposition amount. In this vector, missing data are allowed, however all case for which covariable value is missing are deleted from the analysis. As a consequence, if a covariable with missing data is passed to this function, the Kendall score, tau and p-value will be different than without covariable.

correct

a boolean value. If correct is FALSE, no correction for correlation between blocks is performed. If correct is TRUE, dates are truncated and the correction for correlation between blocks is performed. Note that the truncation is performed in any case, while the correction is performed only if there are more than one block, and more than nine years of data. Default value is FALSE.

rep

a character value. If rep is set to "a", data sharing the same date (or truncated date if correct is TRUE) are averaged. If rep is set to "m", their median is used. For any other value of rep, an error is produced if two or more data share the same date (or truncated date if correct is TRUE). The latter is the default behaviour of the program.

exactp

an boolean value. If exactp is TRUE, there are no ties in y, no block definition and the number of data is not greater than maxp, upper tail exact probability is calculated using the recurrence relation as described in AS 67. Other option were not used, as with modern computer the procedure take a few second, even with 100 data points. For longer time series, the normal approximation can be used.

maxp

a numeric value, defining the maximum numer of data points for the calclaion of exact probability. Beware that with maxp larger than 100, calculation time may became very long.

Details

The MK test for trend analysis was first proposed by Mann (1945).
Hirsch et al. (1982) derived SKT for trend analysis of monthly data in a single site using seasons as the blocking variable, and Helsel and Franse (2006) extended it to a regional test using sites as the blocking variable (RKT).
The correction for correlation among blocks was introduced by Hirsch & Slack (1984), and the partial test was proposed by Libiseller & Grimvall (2002).
At least 4 data are required for each block.
Correction for correlation between blocks is not performed if less than 10 years of data are available.
If correct is FALSE, data are not required to be sampled monthly or yearly.

Value

A list with class rkt is returned with the following components:

sl

two sided p-value by normal approximation

S

Kendall's score

B

Theil-Sen's slope for MK, Seasonal (or Regional) Kendall Slope estimator for SKT and RKT

varS

variance of S

sl.corrected

two sided p-value, after correction for intra-block correlation

varS.corrected

variance of S, after correction for intra-block correlation

partial.S

partial Kendall's score, if a covariable is present

partial.sl

two sided p-value of the partial test, if a covariable is present

partial.varS

partial variance of S, if a covariable is present

partial.sl.corrected

two sided p-value of the partial test, after correction for intra-block correlation, if a covariable is present

partial.varS.corrected

partial variance of S, after correction for intra-block correlation, if a covariable is present

tau

Kendall tau, corrected for ties

exact_p

Upper tail exact probability, if there are no ties, no more than 100 data points and exactp is TRUE

Note

All items are returned in any case. When a test is not performed, relative items are set to NA.
To consider data sharing the same dates as ties in the time domain, please use Kendall function in the Kendall package.
For time series with multiple detection limits, please refer to the NADA package.
Thanks to Peter Waldner (WSL, Switzerland) and Claudia von Bromssen (SLU, Sweden) for their contribution.

Author(s)

Aldo Marchetto <aldo.marchetto@cnr.it>

References

Helsel D.R., Frans L.M. 2006 The regional Kendall test for trend: Environmental Science and Technology 40, 4066–4073

Helsel D.R., Mueller D.K., Slack J.R. 2006 Computer program for the Kendall family of trend tests U.S. Geological Survey Scientific Investigations Report 2005-5275, 4 pp.

Hirsch R.M., Slack J.R., Smith R.A. Techniques of trend ananlyis for monthly water quality data. Water Resources Research 18, 107-121

Hirsch R.M., Slack J.R. 1984 A nonparametric test for seasonal data with serial dependance. Water Resources Research 20, 727-732

Libiseller C., Grimvall A. 2002 Perfomance of partial Mann-Kendall tests for trend detection in the presence of covariates. Environmetrics 13, 71-84

Mann H.B. 1945. Nonparametric tests against trend. Econometrica 13, 245-249

Kaarsemaker L., Wijngaarden A. van 1953 Tables for use in rank correlation. Report R73 of the Computation Depattment of the Mathematical Centre, Amsterdam

Best, D.J., Gipps, P.G. 1974 Algorithm AS 71: The Upper Tail Probabilities of Kendall's Tau. Journal of the Royal Statistical Society. Series C (Applied Statistics), 23: 98-100

Marchetto A., Rogora M., Arisci S. 2013 Trend analysis of atmospheric deposition data: a comparison of statistical approaches. Atmospheric Environment 64, 95-102

See Also

print.rkt

Examples

#
# monthly data
#
data(pie1)
ex<-rkt(pie1$Year,pie1$SO4,pie1$Month,pie1$mm,TRUE)
print(ex)
#
# weekly data, no intrablock correction
#

data(pie1w)
ex<-rkt(pie1w$Date,pie1w$SO4)
print(ex)
#
# monthly data, hydrological years (oct-sep) as in USGS program
#
data(pie1)
ex<-rkt(pie1$Year+floor(pie1$Month/10),pie1$SO4,pie1$Month,,TRUE)
print(ex)

rkt documentation built on Aug. 26, 2026, 1:07 a.m.