nicheOver: Niche overlap

Description Usage Arguments Details Value Author(s) References Examples

View source: R/nicheOver.R

Description

Compute niche overlap among rasters in a RasterStack

Usage

1
nicheOver(stack, metric = c("D", "O"))

Arguments

stack

RasterStack

metric

Metric for niche overlap. Options are D and O (see details).

Details

Niche overlap measures the similarity of the environmental ranges occupied by each constructed model via operating the difference between two vectors of probability distributions.

D: Schoeners statistic for niche overlap (Warren et al., 2008). O: Pianka index (Pianka, 1973).

Value

Matrix of overlap values for metric D or O.

Author(s)

M. Iturbide

References

Warren DL, Glor RE, Turelli M, Funk D (2008) Environmental niche equivalency versus conservatism: Quantitative approaches to niche evolution. Evolution, 62, 2868-2883. doi:10.1111/j.1558-5646.2008. 00482.x.

Pianka ER (1973) The Structure of Lizard Communities. Annual Review of Ecology and Systematics, 4, 53-74. doi:10.1146/annurev.es.04.110173.000413.

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
# SHORT EXAMPLE
destfile <- tempfile()
data.url <- "https://raw.githubusercontent.com/SantanderMetGroup/mopa/master/data/biostack.rda"
download.file(data.url, destfile)
load(destfile, verbose = TRUE)

## Fitted models
data(mods)
?mods

## Model prediction
newClim <- lapply(1:4, function(x){
crop(biostack$future[[x]], extent(-10, 10, 35, 65))
})
names(newClim) <- names(biostack$future)[1:4]
prdRS.fut <- mopaPredict(models = mods, newClim = newClim)

## Extract predictions for pseudo-absence realizaion number 1
predsPA01 <- extractFromPrediction(predictions = prdRS.fut, value = "PA01")
no <- nicheOver(predsPA01, metric = "D")
library(lattice)
levelplot(no, col.regions = rev(terrain.colors(16)))


# FULL WORKED EXAMPLE
## Load climate data
destfile <- tempfile()
data.url <- "https://raw.githubusercontent.com/SantanderMetGroup/mopa/master/data/biostack.rda"
download.file(data.url, destfile)
load(destfile, verbose = TRUE)

## Load fitted models
data(mods)
?mods # see how it is generated
## Model prediction
preds <- mopaPredict(models = mods, newClim = biostack$future)

## Extract predictions for pseudo-absence realizaion number 1
preds1 <- extractFromPrediction(predictions = preds, value = "PA01")

## Compute niche overlap
no <- nicheOver(preds1, metric = "D")
library(lattice)
levelplot(no, col.regions = rev(terrain.colors(16)))

mopa documentation built on May 2, 2019, 6:47 a.m.

Related to nicheOver in mopa...