significantTau {gimms} | R Documentation |
Compute (Pre-Whitened) Kendall's
Description
Apply the Mann-Kendall trend test (Mann, 1945) to a series of observations
and return Kendall's (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 signature 'numeric'
significantTau(
x,
p = 0.001,
prewhitening = TRUE,
method = c("yuepilon", "zhang"),
df = FALSE
)
## S4 method for signature 'RasterStackBrick'
significantTau(
x,
p = 0.001,
prewhitening = TRUE,
method = c("yuepilon", "zhang"),
filename = "",
...
)
Arguments
x |
Either a |
p |
|
prewhitening |
|
method |
|
df |
|
filename |
|
... |
Further arguments passed to |
Details
If available, the function will automatically use open multi-core clusters
for parallel processing (see beginCluster
and Examples).
Value
numeric
input: Ifdf = FALSE
(default), a singlenumeric
orlogical
(i.e.,NA
) depending on whether or not 'p' was exceeded; else adata.frame
with Kendall'sand the corresponding significance level.
RasterStackBrick
input: ARasterLayer
with values of Kendall's. 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.
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, 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,doi:10.1002/hyp.1095.
See Also
MannKendall
, zyp.trend.vector
.
Examples
## 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)
## 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()
}
## End(Not run)