thresholds: Thresholds

Description Usage Arguments Details Value Author(s) Examples

View source: R/thresholds.R

Description

Compute three threshold values: minimum training presence, equal training sensitivity and specificity and maximum training sensitivity plus specificity together with fractional predicted area and the omission rate. If a test dataset is provided it returns also the equal test sensitivity and specificity and maximum test sensitivity plus specificity thresholds and the p-values of the one-tailed binomial exact test.

Usage

1
thresholds(model, type = NULL, test = NULL)

Arguments

model

SDMmodel object.

type

character. The output type used for "Maxent" and "Maxnet" methods, possible values are "cloglog" and "logistic", default is NULL.

test

SWD testing locations, if not provided it returns the training and test thresholds, default is NULL.

Details

The equal training sensitivity and specificity minimizes the difference between sensitivity and specificity. The one-tailed binomial test checks that test points are predicted no better than by a random prediction with the same fractional predicted area.

Value

data.frame with the thresholds.

Author(s)

Sergio Vignali

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Acquire environmental variables
files <- list.files(path = file.path(system.file(package = "dismo"), "ex"),
                    pattern = "grd", full.names = TRUE)
predictors <- raster::stack(files)

# Prepare presence and background locations
p_coords <- virtualSp$presence
bg_coords <- virtualSp$background

# Create SWD object
data <- prepareSWD(species = "Virtual species", p = p_coords, a = bg_coords,
                   env = predictors, categorical = "biome")

# Split presence locations in training (80%) and testing (20%) datasets
datasets <- trainValTest(data, test = 0.2, only_presence = TRUE)
train <- datasets[[1]]
test <- datasets[[2]]

# Train a model
model <- train(method = "Maxnet", data = train, fc = "l")

# Get the cloglog thresholds
thresholds(model, type = "cloglog")

# Get the logistic thresholds passing the test dataset
thresholds(model, type = "logistic", test = test)

Example output

   _____  ____   __  ___ __
  / ___/ / __ \ /  |/  // /_ __  __ ____   ___
  \__ \ / / / // /|_/ // __// / / // __ \ / _ \
 ___/ // /_/ // /  / // /_ / /_/ // / / //  __/
/____//_____//_/  /_/ \__/ \__,_//_/ /_/ \___/  version 1.1.3

To cite this package in publications type: citation("SDMtune").
Extracting predictor information for presence locations...
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
Extracting predictor information for absence/background locations...
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
                                      Threshold Cloglog value
1                     Minimum training presence    0.09379675
2    Equal training sensitivity and specificity    0.50365877
3 Maximum training sensitivity plus specificity    0.26744579
  Fractional predicted area Training omission rate
1                    0.5360                0.00000
2                    0.2312                0.23125
3                    0.3550                0.04375
                                      Threshold Logistic value
1                     Minimum training presence     0.08966081
2    Equal training sensitivity and specificity     0.41193477
3 Maximum training sensitivity plus specificity     0.23735028
4        Equal test sensitivity and specificity     0.36411480
5     Maximum test sensitivity plus specificity     0.22794855
  Fractional predicted area Training omission rate Test omission rate P-values
1                    0.5360                0.00000       0.0000000000        0
2                    0.2312                0.23125       0.0051181102        0
3                    0.3550                0.04375       0.0009842520        0
4                    0.2620                0.18125       0.0041338583        0
5                    0.3622                0.04375       0.0003937008        0

SDMtune documentation built on July 17, 2021, 9:06 a.m.