rkt | R Documentation |
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.
rkt(date, y, block, cv, correct = F, rep = "e")
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 |
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. |
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.
A list with class rkt is returned with the following components:
sl |
two sided p-value |
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 |
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.
Aldo Marchetto <aldo.marchetto@cnr.it>
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
Marchetto A., Rogora M., Arisci S. 2013 Trend analysis of atmospheric deposition data: a comparison of statistical approaches. Atmospheric Environment 64, 95–102
print.rkt
#
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.