Skip to content
Prev 21807 / 29559 Next

Mann-kendall

Not to dissuade any interesting new algorithm development, and I may
be missing something in the motivation for what you're trying to
accomplish, but have you looked at the Kendall package and tried using
it on your raster object?  I've been pleasantly surprised at its
efficiency for at least moderately sized raster stacks.  I've
implemented something like the following on real MODIS time series and
it works well (simulated data provided here):


#install.packages("Kendall")

require(raster)
require(Kendall)

## Simulate a small 25x25x25 raster with uncorrelated but trended series:
set.seed(2002)
slopes <- matrix(rnorm(625, 0, 1), nrow=25, ncol=25)

r <- raster(slopes*1+matrix(rnorm(625, 0, 1), nrow=25, ncol=25))
s <- stack(r)

for (i in 2:25) {
r <- raster(slopes*i+matrix(rnorm(625, 0, 1), nrow=25, ncol=25))
s <- addLayer(s, r)
}


## Confirm on a series with a high slope:
slopes[1,3]
plot(1:25, s[1,3,])
MannKendall(s[1,3,])

## vs. one that has a very small slope:
slopes[1,1]
plot(1:25, s[1,1,])
MannKendall(s[1,1,])


## Mann-Kendall on one pixel:
MannKendall(s[1,1,])


## Perform Mann-Kendall on all pixels:
a <- calc(s, fun=function(x) { return(unlist(MannKendall(x)))})

## Plot pixel-level Kendall Tau and p-values:
plot(a$tau)
plot(a$sl)



Again, I might be missing something about your goals but hopefully
this helps someone out there with similar problems.

Sincerely,
Forrest

--
Forrest R. Stevens
Ph.D. Candidate, QSE3 IGERT Fellow
Department of Geography
Land Use and Environmental Change Institute
University of Florida
www.clas.ufl.edu/users/forrest
On Wed, Oct 8, 2014 at 6:02 PM, Nuno S? <nunocesardesa at gmail.com> wrote: