Learn R Programming

gimms (version 1.0.0)

significantTau: Compute (Pre-Whitened) Kendall's \(\tau\)

Description

Apply the Mann-Kendall trend test (Mann, 1945) to a series of observations and return Kendall's \(\tau\) (Kendall, 1938) based on a predefined significance level. In contrast to other readily available implementations, it is left to the user to decide whether or not to apply pre-whitening as described in the zyp package vignette (Bronaugh and Werner, 2013).

Usage

# S4 method for numeric
significantTau(x, p = 0.001, prewhitening = TRUE,
  method = c("yuepilon", "zhang"), df = FALSE)

# S4 method for RasterStackBrick significantTau(x, p = 0.001, prewhitening = TRUE, method = c("yuepilon", "zhang"), filename = "", ...)

Arguments

x

Either a Raster* object or a numeric vector.

p

numeric, defaults to 0.001. Significance level to be tested.

prewhitening

logical. If TRUE (default), pre-whitening is applied prior to the Mann-Kendall trend test.

method

character. The prewhitening method to apply, see zyp.trend.vector.

df

logical, defaults to FALSE. If TRUE, a data.frame holding the value of Kendall's \(\tau\) and the referring significance level.

filename

character. Optional output filename.

...

Further arguments passed to writeRaster.

Value

  • numeric input: If df = FALSE (default), a single numeric or logical (i.e., NA) depending on whether or not 'p' was exceeded; else a data.frame with Kendall's \(\tau\) and the corresponding significance level.

  • RasterStackBrick input: A RasterLayer with values of Kendall's \(\tau\). Values exceeding the specified 'p' are discarded.

References

Kendall, M.G. (1938). A new measure of rank correlation. Biometrika 30(1/2), 81-93, doi: 10.2307/2332226. Available online at http://www.jstor.org/stable/2332226 (accessed 2015-11-06).

Mann, H.B. (1945). Nonparametric tests against trend. Econometrica 13(3), 245-259, doi: 10.2307/1907187. Available online at http://www.jstor.org/stable/1907187 (accessed 2015-11-06).

Zhang, X., Vincent, L.A., Hogg, W.D. and A. Niitsoo (2000). Temperature and Precipitation Trends in Canada during the 20th Century. Atmosphere-Ocean 38(3), 395-429, doi: 10.1080/07055900.2000.9649654. Available online at http://www.tandfonline.com/doi/abs/10.1080/07055900.2000.9649654 (accessed 2015-11-06).

Yue, S., Pilon, P., Phinney, B. and G. Cavadias (2002). The influence of autocorrelation on the ability to detect trend in hydrological series. Hydrological Processes 16, 1807-1829, doi: 10.1002/hyp.1095. Available online at http://onlinelibrary.wiley.com/doi/10.1002/hyp.1095/abstract (accessed 2015-11-06).

See Also

MannKendall, zyp.trend.vector.

Examples

Run this code
# NOT RUN {
## Example taken from ?Kendall::MannKendall
library(Kendall)
data(PrecipGL)
plot(PrecipGL)

## Mann-Kendall trend test without pre-whitening
x <- as.numeric(PrecipGL)
significantTau(x, p = 0.001, prewhitening = FALSE, df = TRUE)

## Mann-Kendall trend test with pre-whitening
significantTau(x, p = 0.001, prewhitening = TRUE, df = TRUE)

#############################################################################
### use case: significant mann-kendall trends in ndvi3g.v0          #########
#############################################################################

# }
# NOT RUN {
## Sample data from 1982 to 2013
data("kili3g.v0")
rst <- kili3g.v0[[13:nlayers(kili3g.v0)]]

## Remove seasonal signal
library(remote)
dsn <- deseason(rst, cycle.window = 24)

## Calculate trend-free pre-whitened Mann-Kendall trends (note that
## non-significant pixels are set to NA)
trd <- significantTau(dsn, p = 0.01, prewhitening = TRUE)

library(mapview)
mapview(trd)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab