tssWeighted | R Documentation |
This function calculates the True Skill Statistic (TSS).
tssWeighted( pres, contrast, presWeight = rep(1, length(pres)), contrastWeight = rep(1, length(contrast)), thresholds = seq(0, 1, by = 0.01), na.rm = FALSE, bg = NULL, bgWeight = NULL, ... )
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 |
bg |
Same as |
bgWeight |
Same as |
... |
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.
fpb
, aucWeighted
, link[enmSdm]{contBoyce}
, link[enmSdm]{contBoyce2x}
set.seed(123) # set of bad and good predictions at presences bad <- runif(100)^2 good <- runif(100)^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) tssWeighted(pres, contrast) # upweight bad predictions presWeight <- c(rep(1, 100), rep(0.1, 100)) tssWeighted(pres, contrast, presWeight=presWeight) # upweight good predictions presWeight <- c(rep(0.1, 100), rep(1, 100)) tssWeighted(pres, contrast, presWeight=presWeight) e <- dismo::evaluate(pres, contrast) max(e@TPR + e@TNR) - 1 # why different from dismo's evaluate() function? # because uses different thresholds based on values of # presence and absence predictions head(e@t)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.