evalTSS | R Documentation |
This function calculates the True Skill Statistic (TSS).
evalTSS(
pres,
contrast,
presWeight = rep(1, length(pres)),
contrastWeight = rep(1, length(contrast)),
thresholds = seq(0, 1, by = 0.001),
na.rm = FALSE,
...
)
pres |
Numeric vector. Predicted values at test presences |
contrast |
Numeric vector. Predicted values at background/absence sites. |
presWeight |
Numeric vector same length as |
contrastWeight |
Numeric vector same length as |
thresholds |
Numeric vector. Thresholds at which to calculate the sum of sensitivity and specificity. The default evaluates all values from 0 to 1 in steps of 0.01. |
na.rm |
Logical. If |
... |
Other arguments (unused). |
This function calculates the maximum value of the True Skill Statistic (i.e., across all thresholds, the values that maximizes sensitivity plus specificity).
Numeric value.
See Allouche, O., Tsoar, A., and Kadmon, R. 2006. Assessing the accuracy of species distribution models: Prevalence, kappa and the true skill statistic (TSS). Journal of Applied Ecology 43:1223-1232. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/j.1365-2664.2006.01214.x")}
pa_evaluate
, evalAUC
, evalMultiAUC
, evalContBoyce
, evalThreshold
, evalThresholdStats
, evalTjursR2
set.seed(123)
# set of bad and good predictions at presences
bad <- runif(30)^2
good <- runif(30)^0.1
hist(good, breaks=seq(0, 1, by=0.1), border='green', main='Presences')
hist(bad, breaks=seq(0, 1, by=0.1), border='red', add=TRUE)
pres <- c(bad, good)
contrast <- runif(1000)
evalTSS(pres, contrast)
# upweight bad predictions
presWeight <- c(rep(1, 30), rep(0.1, 30))
evalTSS(pres, contrast, presWeight=presWeight)
# upweight good predictions
presWeight <- c(rep(0.1, 30), rep(1, 30))
evalTSS(pres, contrast, presWeight=presWeight)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.