Learn R Programming

gimms (version 1.2.2)

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 up 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 = "", ... )

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.

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.

Details

If available, the function will automatically use open multi-core clusters for parallel processing (see beginCluster and Examples).

References

Kendall, M.G. (1938). A new measure of rank correlation. Biometrika 30(1/2), 81-93, doi: 10.2307/2332226.

Mann, H.B. (1945). Nonparametric tests against trend. Econometrica 13(3), 245-259, doi: 10.2307/1907187.

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, tools:::Rd_expr_doi("10.1080/07055900.2000.9649654").

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,tools:::Rd_expr_doi("10.1002/hyp.1095").

See Also

MannKendall, zyp.trend.vector.

Examples

Run this code
## 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          #########
#############################################################################

if (FALSE) {
## 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)

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

## Or, alternatively, use multi-core functionality
cores <- parallel::detectCores() - 1
if (require(snow)) {
  beginCluster(cores)
  trd2 <- significantTau(dsn, p = 0.01, prewhitening = TRUE)
  endCluster()
}
}

Run the code above in your browser using DataLab