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