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

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. The program can compute the result using serial (default) or parallel evaluation. For parallel evaluation, the program uses PSOCK cluster for windows, and FORK cluster for other operative systems.

Usage

1
2
3
4
5
6
7
8
9
eco.theilsen(
  stacked,
  dates,
  adjust = "none",
  run_parallel = FALSE,
  workers = NULL,
  physical = FALSE,
  cl_type = NULL
)

Arguments

stacked

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

dates

Data vector with decimal dates for each image.

adjust

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

run_parallel

Run code in parallel? Default FALSE

workers

Number of workers used for parallel evaulation. If NULL, the program uses N - 1, where N is the total number of available logical cores.

physical

Use only physical cores for parallel evaluation? Default FALSE.

cl_type

Cluster type. If not specified, "PSOCK" will be used for windows and "FORK" otherwise. The value is passed as the parameter "type" to the function makeCluster.

Author(s)

Leandro Roser learoser@gmail.com

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
## 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)


# Parallel evaluation ----

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("slope.tif", "pvalue.tif"))


# Serial evaluation ----

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 July 8, 2020, 5:46 p.m.