eco.theilsen: Theil-sen regression for a raster time series

Description Usage Arguments Author(s) References See Also Examples

Description

This function computes the theil-sen estimator and the associated P-value, for each pixel over time in a stack of images. The output consists of two rasters (one for the estimators and one for the P-values). It is recommended to use a "RasterBrick", which is more efficient in memory management.

Usage

1
eco.theilsen(stacked, date, adjust = "none")

Arguments

stacked

Stacked images ("RasterLayer" or "RasterBrick").

date

data vector with decimal dates for each image.

adjust

P-values correction method for multiple tests passed to p.adjust. Defalut is "none".

Author(s)

Leandro Roser [email protected]

References

Sen, P. 1968. Estimates of the regression coefficient based on Kendall's tau. Journal of the American Statistical Association, Taylor and Francis Group, 63: 1379-1389.

Theil H. 1950. A rank-invariant method of linear and polynomial regression analysis, Part 3 Proceedings of Koninalijke Nederlandse Akademie van Weinenschatpen A, 53: 397-1412.

See Also

rkt.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Not run: 
require("raster")
set.seed(6)

temp <- list()
for(i in 1:100) {
temp[[i]] <- runif(36,-1, 1)
temp[[i]] <- matrix(temp[[i]], 6, 6)
temp[[i]] <- raster(temp[[i]])
}

temp <- brick(temp)


writeRaster(temp,"temporal.tif", overwrite=T)
rm(temp)
ndvisim <- brick("temporal.tif")

date <- seq(from = 1990.1, length.out = 100, by = 0.2)

eco.theilsen(ndvisim, date)

slope <- raster("slope.tif")
pvalue <- raster("pvalue.tif")

par(mfrow = c(1, 2))
plot(slope, main = "slope")
plot(pvalue, main = "p-value")


file.remove(c("temporal.tif", "slope.tif", "pvalue.tif"))

## End(Not run)

EcoGenetics documentation built on Jan. 14, 2018, 9:04 a.m.