evalAUC {enmSdmX}R Documentation

Weighted AUC

Description

This function calculates the area under the receiver-operator characteristic curve (AUC) following Mason & Graham (2002). Each case (presence/non-presence) can be assigned a weight, if desired.

Usage

evalAUC(
  pres,
  contrast,
  presWeight = rep(1, length(pres)),
  contrastWeight = rep(1, length(contrast)),
  na.rm = FALSE,
  ...
)

Arguments

pres

Vector of predictions for "positive" cases (e.g., predictions at presence sites).

contrast

Vector of predictions for "negative" cases (e.g., predictions at absence/background sites).

presWeight

Weights of positive cases. The default is to assign each positive case a weight of 1.

contrastWeight

Weights of contrast cases. The default is to assign each case a weight of 1.

na.rm

Logical. If TRUE then remove any positive cases and associated weights and contrast predictions and associated weights with NAs.

...

Other arguments (unused).

Value

A Numeric value.

See Also

pa_evaluate, evalMultiAUC

Examples

pres <- seq(0.5, 1, by=0.1)
contrast <- seq(0, 1, by=0.01)

# unweighted
evalAUC(pres, contrast)

# weighted (weight presences with low predictions more)
presWeight <- c(1, 1, 1, 0.5, 0.5, 0.5)
evalAUC(pres, contrast, presWeight=presWeight)

# weighted (weight presences with high predictions more)
presWeight <- c(0.5, 0.5, 0.5, 1, 1, 1)
evalAUC(pres, contrast, presWeight=presWeight)

# weight presences and absences
contrastWeight <- sqrt(contrast)
evalAUC(pres, contrast, presWeight=presWeight, contrastWeight=contrastWeight)

[Package enmSdmX version 1.1.5 Index]