Package 'rkt'

Title: Mann-Kendall Test, Seasonal and Regional Kendall Tests
Description: Contains function rkt which 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.
Authors: Aldo Marchetto
Maintainer: Aldo Marchetto <[email protected]>
License: GPL-2
Version: 1.7
Built: 2024-10-31 20:40:49 UTC
Source: CRAN

Help Index


Mann-Kendall Test, Seasonal and Regional Kendall Tests

Description

Contains function rkt which 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.

Details

Package: rkt
Type: Package
Version: 1.7
Date: 2024-02-07
License: GPL-2

This function computes the Mann-Kendall test (MK) and the Seasonal and the Regional Kendall Tests for trend (SKT and RKT) and Sen's slope estimator.
MK, SKT and RKT are tests for monotonic trend in time series based on the Kendall rank correlation.
SKT and RKT are intrablock tests in which test statistics are computed for each season or month (SKT) or for each site (RKT) and combined in an overall test.
In RKT, seasonality can be accounted for by using a blocking variable combining both sites and seasons, such as (site * 12 + month).
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.

Author(s)

Maintainer: Aldo Marchetto <[email protected]>

References

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

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

Examples

#
# monthly data, using covariate and intra-block correction
#
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)
#

Example data for rkt function

Description

Bulk open field deposition collected in Val Sessera (Italy) in 1998-2010, volume weighted monthly averages.

Usage

data(pie1)

Format

A data frame with 156 observations on the following 5 variables.

Year

sampling year

Month

sampling month

mm

amount of precipitation (mm)

SO4

sulphate concentration (mg/L)

NO3

nitate concentration (mg N/L)

Details

SO4 shows a highly significant decreasing trend, NO3 shows a moderately significant decreasing trend and mm no significant trend

Source

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

Rogora M., Mosello R., Arisci S., Brizzio M., Barbieri A., Balestrini R., Waldner P., Schmitt M., Stahli M.,Thimonier A., Kalina M., Puxbaum H., Nickus U., Ulrich E., Probst A. 2006 An overview of atmospheric deposition chemistry over the Alps: Present status and long-term trends. Hydrobiologia 562, 17–40

Examples

data(pie1)
rkt(pie1$Year,pie1$SO4,pie1$Month,pie1$mm,TRUE)

Example data for rkt function

Description

Bulk open field deposition collected in Val Sessera (Italy) in 1998-2007. Raw weekly data.

Usage

data(pie1)

Format

A data frame with 718 observations on the following 4 variables.

Date

sampling date (year+decimals)

mm

amount of precipitation (mm)

SO4

sulphate concentration (mg/L)

NO3

nitate concentration (mg N/L)

Details

SO4 shows a decreasing trend NO3 and mm show no significant trend

Source

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

Rogora M., Mosello R., Arisci S., Brizzio M., Barbieri A., Balestrini R., Waldner P., Schmitt M., Stahli M.,Thimonier A., Kalina M., Puxbaum H., Nickus U., Ulrich E., Probst A. 2006 An overview of atmospheric deposition chemistry over the Alps: Present status and long-term trends. Hydrobiologia 562, 17–40

Examples

data(pie1w)
rkt(pie1w$Date,pie1w$SO4)

print Method for class rkt

Description

The results of the test(s) and the slope are printed

Usage

## S3 method for class 'rkt'
print(x, ...)

Arguments

x

an object of class rkt, i.e. the output of the rkt function

...

any additional argument

Value

NULL

Author(s)

Aldo Marchetto <[email protected]>

Examples

data(pie1)

ex<-rkt(pie1$Year,pie1$SO4,pie1$Month,pie1$mm,TRUE)
print(ex)

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")

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

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.

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

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

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.

Author(s)

Aldo Marchetto <[email protected]>

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

modified sign() fucntion for SKT taking into account missing data

Description

differ from sign as it return 0 when x is NA

Usage

sign1(x)

Arguments

x

any number

Value

1 if x > 0 -1 if x < 0 0 if x = 0 or x = NA

Note

used by rkt

Author(s)

Aldo Marchetto

References

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

See Also

rkt

Examples

a<-1
sign1(a)
a<-NA
sign1(a)