Skip to contents

Mann-Kendall trend test for 2D rasterStacks, assuming layers represent timepoints.

Usage

tj_contextual_mann_kendall(
  x,
  ...,
  neighbourhood = 2,
  calc_slope = FALSE,
  timevar = "z",
  attrvar = "values"
)

Arguments

x

stars-object, with x,y and time dimensions, and at least one attribute.

...

ignored

neighbourhood

2:queen, 1:rook, 0:none (classical M-K test) Only 2 and 0 implemented.

calc_slope

Calculate Theil-Sen slope estimate for each series? Default:FALSE

timevar

Name of the time dimension. Default "z"

attrvar

Name of the value attribute. Default "values

Value

A stars-object with following attributes: 'S' for the Mann-Kendall Statistic (classical or smoothed); 's2' for the variance of the statistic; 'p' for p-value of trend detected; (optional) 'slope' for the Theil-Sen slope estimate.

Details

Assume that the values of each rasterStack location (cell) over time (layers) are a time-series. This function calculates the Mann-Kendall trend test for each series, and returns the relevant statistics as a new rasterStack.

The **Contextual** version (default; see ref.) simply averages the Mann-Kendall-test's S-statistic at each location over neighbours, very much like running 'focal(S, w=matrix(1/9,3,3))' on the non-contextual/cellwise statistic raster. However, this function also calculates the adjusted variances (and hence the p-values).

NOTE assumes equal interval timeseries if 'time' is missing. Matters only for the slope calculation.

References

Neeti, N. and Eastman J.R. (2011) A Contextual Mann-Kendall Approach for the Assesment of Trend Significance in Image Time Series, Transactions in GIS