contBoyce | R Documentation |
This function calculates the continuous Boyce index (CBI), a measure of model accuracy for presence-only test data. This version uses multiple, overlapping windows, in contrast to link{contBoyce2x}
, which covers each point by at most two windows.
contBoyce( pres, contrast, numBins = 101, binWidth = 0.1, presWeight = rep(1, length(pres)), contrastWeight = rep(1, length(contrast)), autoWindow = TRUE, method = "spearman", dropZeros = TRUE, graph = FALSE, na.rm = FALSE, bg = NULL, bgWeight = NULL, ... )
pres |
Numeric vector. Predicted values at presence sites. |
contrast |
Numeric vector. Predicted values at background sites. |
numBins |
Positive integer. Number of (overlapping) bins into which to divide predictions. |
binWidth |
Positive numeric value < 1. Size of a bin. Each bin will be |
presWeight |
Numeric vector same length as |
contrastWeight |
Numeric vector same length as |
autoWindow |
Logical. If |
method |
Character. Type of correlation to calculate. The default is |
dropZeros |
Logical. If |
graph |
Logical. If |
na.rm |
Logical. If |
bg |
Same as |
bgWeight |
Same as |
... |
Other arguments (not used). |
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.
Numeric value.
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
cor
, link[enmSdm]{contBoyce2x}
set.seed(123) pres <- sqrt(runif(100)) contrast <- runif(1000) contBoyce(pres, contrast) contBoyce2x(pres, contrast) presWeight <- c(rep(1, 10), rep(0.5, 90)) contBoyce(pres, contrast, presWeight=presWeight) contBoyce2x(pres, contrast, presWeight=presWeight) ## Not run: # compare stability of CBI calculated with ecospat.boyce() in ecospat package library(ecospat) set.seed(123) results <- data.frame() for (perform in c(1, 1.5, 2)) { for (i in 1:30) { pres <- runif(100)^(1 / perform) contrast <- runif(1000) cbi_enmSdm <- contBoyce(pres, contrast) cbi_ecospat <- ecospat.boyce(contrast, pres, PEplot=FALSE)$Spearman.cor results <- rbind( results, data.frame( performance = rep(perform, 2), method = c('enmSdm', 'ecospat'), cbi = c(cbi_enmSdm, cbi_ecospat) ) ) } } results$performance[results$performance == 1] <- 'poor' results$performance[results$performance == 1.5] <- 'OK' results$performance[results$performance == 2] <- 'good' results$category <- paste0(results$method, '\n', results$performance) par(mfrow=c(1, 2)) boxplot(cbi ~ category, data=results, ylab='CBI', main='CBI of poor, OK, and good models', border=c(rep('darkred', 3), rep('darkblue', 3)) ) plot(results$cbi, pch=rep(c(21, 22, 23, 24), each=2), contrast=ifelse(results$method == 'ecospat', 'darkred', 'cornflowerblue'), main='Pairs of CBIs', ylab='CBI' ) legend('bottomright', fill=c('darkred', 'cornflowerblue'), legend=c('ecospat', 'enmSdm')) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.