contBoyce2x: Continuous Boyce Index (CBI) with weighting (2X-coverage...

View source: R/contBoyce2x.r

contBoyce2xR Documentation

Continuous Boyce Index (CBI) with weighting (2X-coverage version)

Description

This function calculates the Continuous Boyce Index (CBI), a measure of model accuracy for presence-only test data. Overlapping bins are placed such that any given point (prediction) along [0, 1] is covered by at most 2 bins. See the function contBoyce for a version that allows coverage by 2 or more bins.

Usage

contBoyce2x(
  pres,
  bg,
  numClasses = 10,
  presWeight = rep(1, length(pres)),
  bgWeight = rep(1, length(bg)),
  upweightTails = TRUE,
  na.rm = FALSE,
  autoWindow = TRUE,
  method = "spearman",
  graph = FALSE
)

Arguments

pres

Numeric vector. Predicted values at presence sites.

bg

Numeric vector. Predicted values at background sites.

numClasses

Positive integer. Number of classes into which to divide predictions at background sites. Hirzel et al. suggest using 10 (default).

presWeight

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

bgWeight

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

upweightTails

Logical. TRUE ==> weights of presences and background sites that occur in the first half of the lowest bin or in the second half of the last bin have their weights multiplied by 2.

na.rm

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

autoWindow

Logical. If TRUE then calculate bin boundaries starting at minimum predicted value and ending at maximum predicted value (default). If FALSE calculate bin boundaries starting at 0 and ending at 1.

method

Character. Type of correlation to calculate. The default is 'spearman', the Spearman rank correlation coefficient used by Boyce et al. (2002) and Hirzel et al. (2006), which is the "traditional" CBI. In contrast, 'pearson' or 'kendall' can be used instead. See cor for more details.

graph

Logical. If TRUE then plot P vs E and P/E versus bin.

Details

CBI is the Spearman rank correlation coefficient between the proportion of sites in each prediction class and the expected proportion of predictions in each prediction class based on the proportion of the landscape that is in that class. The index ranges from -1 to 1. Values >0 indicate the model's output is positively correlated with the true probability of presence. Values <0 indicate it is negatively correlated with the true probability of presence.

Value

Numeric value.

References

Boyce, M.S., Vernier, P.R., Nielsen, S.E., and Schmiegelow, F.K.A. 2002. Evaluating resource selection functions. Ecological Modeling 157:281-300. doi: 10.1016/S0304-3800(02)00200-4

Hirzel, A.H., Le Lay, G., Helfer, V., Randon, C., and Guisan, A. 2006. Evaluating the ability of habitat suitability models to predict species presences. Ecological Modeling 199:142-152. doi: 10.1016/j.ecolmodel.2006.05.017

See Also

contBoyce

Examples


set.seed(57)
pres <- seq(0.5, 1, length.out=100)
bg <- runif(1000)
contBoyce2x(pres, bg)
contBoyce(pres, bg)
presWeight <- c(rep(1, 50), rep(0.5, 50))
contBoyce2x(pres, bg, presWeight=presWeight)
contBoyce(pres, bg, presWeight=presWeight)


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