The Boyce index (Boyce et al. 2002) is often described as a presence-only metric for evaluating the predictions of species distribution (or ecological niche, or habitat suitability) models (e.g. Hirzel et al. 2006, Cianfrani et al. 2010, Bellard et al. 2013, Valavi et al. 2022). It measures the predicted-to-expected ratio of presences in each class of predicted values, i.e., whether classes / regions with higher predicted values have indeed higher proportions of presences than expected by chance. But, if there’s a proportion of presences in each class, then the rest of the class (i.e. the complementary proportion) must be… non-presences, which are equally necessary for the computation of this index (as for virtually any other model evaluation metric). We need both pixels with and pixels without presence records, i.e. both presences and (pseudo)absences, or the Boyce index cannot be computed: try using a raster map with values only in pixels with presence (e.g.
my_raster <- mask(my_raster, my_presences)) and see what happens. The same applies to presence-background modelling methods like Maxent and ENFA, which use both the presence and the remaining (i.e. “non-presence”) pixels, and can’t produce proper predictions without non-presence pixels — you can also try this for yourself. So, they need the same data that presence-absence methods need. Whether or not the computation requires an explicit identification of the absences, or just presence points and a map of the entire study area, simply depends on how each method or metric is implemented in each particular software package.
The ‘modEvA‘ R package computes the Boyce index and a range of other metrics that evaluate model predictions against presence/absence or presence/background data, including the area under the ROC curve (AUC), the area under the precision-recall curve, sensitivity, specificity, TSS, Cohen’s kappa, Hosmer-Lemeshow goodness-of-fit, Miller calibration statistics, and several others. For all these metrics, the input can be either 1) a model object of a range of implemented classes, or 2) a pair of numeric vectors with observed presence/absence and the corresponding predicted values, or 3) a set of presence point coordinates and a raster map of the predictions across the model evaluation region. Here some usage examples:
install.packages("modEvA", repos = "http://R-Forge.R-project.org") library(modEvA) library(terra) # import a raster map with a predictor variable: elev <- rast(system.file("ex/elev.tif", package = "terra")) # import a species' occurrence data for this area: gbif <- geodata::sp_occurrence(genus = "Dendrocopos", species = "major", ext = elev) head(gbif) unique(gbif$occurrenceStatus) # remove absences if any! pres_coords <- gbif[ , c("lon", "lat")] plot(elev) points(pres_coords, pch = 20, cex = 0.2) # get a data frame of the pixels with and without presences: dat <- fuzzySim::gridRecords(elev, pres_coords) head(dat) points(dat[dat$presence == 0, c("x", "y")], col = "red", cex = 0.5) points(dat[dat$presence == 1, c("x", "y")], col = "blue", cex = 0.5) # compute a species distribution model (e.g. a GLM) from these data: mod <- glm(presence ~ elevation, family = binomial, data = dat) summary(mod) # get a raster map with the predictions from this model: pred <- predict(elev, mod, type = "response") plot(pred, main = "Woodpecker presences and predictions") points(pres_coords, pch = 20, cex = 0.2)
# compute some model evaluation metrics # using just these presence coordinates and raster predictions: par(mfrow = c(2, 2), mar = c(5, 5, 2, 1)) Boyce(obs = pres_coords, pred = pred, main = "Boyce index") AUC(obs = pres_coords, pred = pred, main = "ROC curve") threshMeasures(obs = pres_coords, pred = pred, thresh = "maxTSS", measures = c("Sensitivity", "Specificity", "Precision", "TSS", "kappa"), standardize = FALSE, main = "Threshold-based") AUC(obs = pres_coords, pred = pred, curve = "PR", main = "PR curve")
So, any evaluation metric can be computed using “only presence points”, as long as the raster map of predictions includes both pixels that do and pixels that don’t overlap these points, the latter of which are necessarily taken as available unoccupied pixels by all of these metrics (Boyce index included).
Note you may get slightly different results with
modEvA::Boyce() and with
ecospat.boyce removes duplicate classes by default, though both functions allow controlling this with argument ‘rm.dup.classes‘ or ‘rm.duplicate‘, respectively (see help file of either function for details). Bug reports and other feedback welcome on this version of package ‘modEvA‘!
Boyce, M.S., P.R. Vernier, S.E. Nielsen & F.K.A. Schmiegelow (2002) Evaluating resource selection functions. Ecological Modelling 157: 281-300
Bellard, C., Thuiller, W., Leroy, B., Genovesi, P., Bakkenes, M., & Courchamp, F. (2013) Will climate change promote future invasions? Global Change Biology, 19(12), 3740. https://doi.org/10.1111/GCB.12344
Cianfrani, C., Le Lay, G., Hirzel, A. H., & Loy, A. (2010) Do habitat suitability models reliably predict the recovery areas of threatened species? Journal of Applied Ecology, 47(2), 421–430. https://doi.org/10.1111/J.1365-2664.2010.01781.X
Hirzel, A. H., Le Lay, G., Helfer, V., Randin, C., & Guisan, A. (2006) Evaluating the ability of habitat suitability models to predict species presences. Ecological Modelling, 199(2), 142-152. http://www.sciencedirect.com/science/article/pii/S0304380006002468
Valavi, R., Guillera-Arroita, G., Lahoz-Monfort, J. J., & Elith, J. (2022) Predictive performance of presence-only species distribution models: a benchmark study with reproducible code. Ecological Monographs, 92(1), e01486. https://doi.org/10.1002/ECM.1486