Last chance! 50% off unlimited learning
Sale ends in
This function calculates Tjur's R2 metric of model discrimination accuracy. Unweighted R2 is simply the difference between the mean predicted value at presence sites and the mean predicted value at absence/background sites. The weighted version allows for differing weights between presences and between absences/contrast values (i.e., the difference between the weighted mean of predictions at presences and weighted mean predictions at absences/contrast locations).
evalTjursR2(
pres,
contrast,
presWeight = rep(1, length(pres)),
contrastWeight = rep(1, length(contrast)),
na.rm = FALSE,
...
)
Numeric value.
Predictions at presence sites.
Predictions at absence/background sites.
Weights of presence cases. The default is to assign each presence case a weight of 1.
Weights of absence/background cases. The default is to assign each case a weight of 1.
Logical. If TRUE
then remove any presences and associated weights and background predictions and associated weights with NA
s.
Other arguments (unused).
Tjur, T. 2009. Coefficients of determination in logistic regression models-A new proposal: The coefficient of discrimination. The American Statistician 63:366-372. tools:::Rd_expr_doi("10.1198/tast.2009.08210")
pa_evaluate
, evalAUC
, evalMultiAUC
, evalContBoyce
, evalThreshold
, evalThresholdStats
, evalTSS
pres <- seq(0.5, 1, by=0.1)
contrast <- seq(0, 1, by=0.01)
# unweighted
evalTjursR2(pres, contrast)
# weighted (weight presences with low predictions more)
presWeight <- c(1, 1, 1, 0.5, 0.5, 0.5)
evalTjursR2(pres, contrast, presWeight=presWeight)
# weighted (weight presences with high predictions more)
presWeight <- c(0.5, 0.5, 0.5, 1, 1, 1)
evalTjursR2(pres, contrast, presWeight=presWeight)
# weight presences and absences
contrastWeight <- sqrt(contrast)
evalTjursR2(pres, contrast, presWeight=presWeight, contrastWeight=contrastWeight)
Run the code above in your browser using DataLab