sediWeighted: Symmetric extremal dependence index (SEDI)

View source: R/sediWeighted.r

sediWeightedR Documentation

Symmetric extremal dependence index (SEDI)

Description

This function calculates the symmetric extremal dependence index (SEDI) using a threshold applied to continuous data to demarcate "presence" from "contrast".

Usage

sediWeighted(
  pres,
  contrast,
  presWeight = rep(1, length(pres)),
  contrastWeight = rep(1, length(contrast)),
  thresholds = seq(0, 1, by = 0.01),
  delta = 0.001,
  na.rm = FALSE,
  bg = NULL,
  bgWeight = NULL,
  ...
)

Arguments

pres

Numeric vector. Predicted values at presence sites.

contrast

Numeric vector. Predicted values at absence/background sites.

presWeight

Numeric vector same length as pres. Relative weights of presence sites. The default is to assign each presence a weight of 1.

contrastWeight

Numeric vector same length as contrast. Relative weights of background sites. The default is to assign each presence a weight of 1.

thresholds

Numeric vector, Values at which to threshold predictions for calculation of SEDI.

delta

Positive numeric >0 in the range [0, 1] and usually very small. This value is used only if calculating the SEDI threshold when any true positive rate or false negative rate is 0 or the false negative rate is 1. Since SEDI uses log(x) and log(1 - x), values of 0 and 1 will produce NAs. To obviate this, a small amount can be added to rates that equal 0 and subtracted from rates that equal 1.

na.rm

Logical. If TRUE then remove any presences and associated weights and absence/background predictions and associated weights with NAs.

bg

Same as contrast. Included for backwards compatibility. Ignored if contrast is not NULL.

bgWeight

Same as contrastWeight. Included for backwards compatibility. Ignored if contrastWeight is not NULL.

...

Other arguments (unused).

Value

Numeric value.

References

Wunderlich, R.F., Lin, Y-P., Anthony, J., and Petway, J.R. 2019. Two alternative evaluation metrics to replace the true skill statistic in the assessment of species distribution models. Nature Conservation 35:97-116.

See Also

cor, fpb, aucWeighted, link[enmSdm]{contBoyce}, link[enmSdm]{contBoyce2x}, link[enmSdm]{thresholdWeighted}, link[enmSdm]{thresholdStats}

Examples

set.seed(123)
pres <- sqrt(runif(100))
contrast <- runif(10000)
hist(contrast, col='gray', xlim=c(0, 1), breaks=20)
hist(pres, col='green', breaks=20, add=TRUE)
max(sediWeighted(pres, contrast), na.rm=TRUE)
# SEDI is fairly insensitive to weighting (as per Wunderlich et al. 2019)
presWeight <- c(rep(1, 50), rep(1000, 50))
max(sediWeighted(pres, contrast, presWeight=presWeight), na.rm=TRUE)

adamlilith/enmSdm documentation built on Jan. 6, 2023, 11 a.m.