Skip to contents

TSS = sensitivity + specificity - 1, ranging from -1 to 1 (0 = random). By default the threshold that maximises TSS is used (the same as the maximum of Youden's J). This is the usual way TSS is reported, but it is slightly optimistic on hold-out data. Supply a threshold fixed beforehand (e.g. from calibration data, see threshold_p10()) for a strict hold-out value.

Usage

tss_score(obs, pred, threshold = NULL)

Arguments

obs

Numeric vector of observations (1 = presence, 0 = absence).

pred

Numeric vector of predicted suitability.

threshold

Optional fixed threshold; predictions >= threshold count as presences. NULL (default) uses the TSS-maximising threshold.

Value

A single number. The threshold used is stored in attr(, "threshold").

Details

Limits. TSS depends on the threshold, and at the TSS-maximising threshold it is optimistic. With background points, specificity counts unrecorded presences as errors.

References

Allouche, O., Tsoar, A., 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. doi:10.1111/j.1365-2664.2006.01214.x

Examples

tss_score(c(1, 1, 0, 0), c(0.9, 0.6, 0.7, 0.1))
#> [1] 0.5
#> attr(,"threshold")
#> [1] 0.9
tss_score(c(1, 1, 0, 0), c(0.9, 0.6, 0.7, 0.1), threshold = 0.5)
#> [1] 0.5
#> attr(,"threshold")
#> [1] 0.5