library(BiodiversityR)
library(raster)
library(rgdal)
library(dismo)
library(terra)
library(ggmap)
library(ggspatial)
library(ggforce)
The main objectives of this document were to:
Another objective was to compare execution speeds between the raster and terra packages (see here for an alternative example).
In addition, this document illustrates some of the methods used to create a climate change atlas for Africa.
The example shown here builds on the examples provided in the documentation for BiodiversityR (e.g., ensemble.raster) and previously provided in the dismo package (a modified set of tutorials for is available now via rspatial.org, e.g. Species distribution modelling: environmental data).
predictor.files <- list.files(path=paste(system.file(package="dismo"), '/ex', sep=''),
pattern='grd', full.names=TRUE)
predictors.raster <- stack(predictor.files)
predictors.raster
## class : RasterStack
## dimensions : 192, 186, 35712, 9 (nrow, ncol, ncell, nlayers)
## resolution : 0.5, 0.5 (x, y)
## extent : -125, -32, -56, 40 (xmin, xmax, ymin, ymax)
## crs : +proj=longlat +datum=WGS84 +no_defs
## names : bio1, bio12, bio16, bio17, bio5, bio6, bio7, bio8, biome
## min values : -23, 0, 0, 0, 61, -212, 60, -66, 1
## max values : 289, 7682, 2458, 1496, 422, 242, 461, 323, 14
Especially to load the environmental data into terra, the raster layers are converted to the geotiff format:
for (i in 1:length(names(predictors.raster))) {
raster.focal <- predictors.raster[[i]]
raster::writeRaster(raster.focal,
filename=paste0(names(raster.focal), ".tif"),
overwrite=TRUE)
}
These geotiff files can now be used to create the raster::rasterStack
predictor.files <- list.files(getwd(),pattern=".tif", full.names=TRUE)
predictor.files <- predictor.files[grepl(pattern= "bio", x=predictor.files)]
predictors.raster <- raster::stack(predictor.files)
predictors.raster
## class : RasterStack
## dimensions : 192, 186, 35712, 9 (nrow, ncol, ncell, nlayers)
## resolution : 0.5, 0.5 (x, y)
## extent : -125, -32, -56, 40 (xmin, xmax, ymin, ymax)
## crs : +proj=longlat +datum=WGS84 +no_defs
## names : bio1, bio12, bio16, bio17, bio5, bio6, bio7, bio8, biome
## min values : -23, 0, 0, 0, 61, -212, 60, -66, 1
## max values : 289, 7682, 2458, 1496, 422, 242, 461, 323, 14
The same files can be used to create the SpatRaster object for terra
predictors.terra <- terra::rast(predictor.files)
predictors.terra
## class : SpatRaster
## dimensions : 192, 186, 9 (nrow, ncol, nlyr)
## resolution : 0.5, 0.5 (x, y)
## extent : -125, -32, -56, 40 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## sources : bio1.tif
## bio12.tif
## bio16.tif
## ... and 6 more source(s)
## names : bio1, bio12, bio16, bio17, bio5, bio6, ...
## min values : -23, 0, 0, 0, 61, -212, ...
## max values : 289, 7682, 2458, 1496, 422, 242, ...
The dismo package contains presence observations of Bradypus variegatus, the brown-throated three-toed sloth (See also here or here).
presence_file <- paste(system.file(package="dismo"), '/ex/bradypus.csv', sep='')
pres <- read.table(presence_file, header=TRUE, sep=',')[,-1]
summary(pres)
## lon lat
## Min. :-85.93 Min. :-23.450
## 1st Qu.:-79.20 1st Qu.: -2.896
## Median :-75.08 Median : 4.817
## Mean :-71.79 Mean : 2.449
## 3rd Qu.:-65.51 3rd Qu.: 9.150
## Max. :-40.07 Max. : 13.950
Environmental thinning is a method to reduce bias in presence observations. The algorithms in BiodiversityR are similar to spatial thinning, but require a target final number of records instead of a target minimum geographical distance as in spatial thinning.
To obtain the target final number of records, first spatial thinning is done using a commonly used minimum distance of 10 km (but see Castellanos et al. 2019).
pres.spat <- BiodiversityR::ensemble.spatialThin(x=pres,
thin.km=10.0)
## Warning in .couldBeLonLat(x, warnings = warnings): CRS is NA. Assuming it is
## longitude/latitude
## Spatially thinned point location data set obtained for target minimum distance of 10
## number of locations: 108
## minimum distance: 13413.9512933096
Environmental thinning is done with the target of the same number of records:
pres.env <- BiodiversityR::ensemble.environmentalThin(x=pres,
predictors.stack=predictors.raster,
thin.n=nrow(pres.spat))
##
## Percentage of variance of the selected axes (1 to 4) of principal components analysis: 100
## Environmentally thinned point location data set obtained with first algorithm
## number of locations: 108
## minimum distance: 0
##
## Environmentally thinned point location data set obtained with second algorithm
## number of locations: 108
## minimum distance: 0
As it happens, the minimum environmental distance is zero for the environmentally-thinned data set. Hence the target is lowered further to 90:
pres.env <- BiodiversityR::ensemble.environmentalThin(x=pres,
predictors.stack=predictors.raster,
thin.n=90)
##
## Percentage of variance of the selected axes (1 to 4) of principal components analysis: 100
## Environmentally thinned point location data set obtained with first algorithm
## number of locations: 90
## minimum distance: 0.0400097
##
## Environmentally thinned point location data set obtained with second algorithm
## number of locations: 90
## minimum distance: 0.0472273
Since the environmental distance is larger than zero, we are certain that there is only one presence observation per raster cell (such condition has been used in several studies). At the same time, locations are further than 10 km apart.
pres.env.test <- BiodiversityR::ensemble.spatialThin(x=pres.env, thin.km=10)
## Warning in .couldBeLonLat(x, warnings = warnings): CRS is NA. Assuming it is
## longitude/latitude
## WARNING: thinning parameter smaller or equal to minimum distance among locations
## therefore all locations selected
The results of the thinning process can be visualized as follows.
pres.removed <- pres[(rownames(pres) %in% rownames(pres.env)) == FALSE, ]
Note that you need to register to obtain the Stamen maps; see here.
bbox_study <- c(left=as.numeric(ext(predictors.raster)$xmin),
bottom=as.numeric(ext(predictors.raster)$ymin),
right=as.numeric(ext(predictors.raster)$xmax),
top=as.numeric(ext(predictors.raster)$ymax))
# Modified October 2025
stamen_study <- get_stadiamap(bbox_study, zoom=4, force=TRUE,
maptype="stamen_terrain_background")
stamen_map <- ggmap(stamen_study)
bbox_study2 <- c(left=min(pres$lon-5),
bottom=min(pres$lat-5),
right=max(pres$lon+8),
top=max(pres$lat+5))
stamen_study2 <- get_stadiamap(bbox_study2, zoom=5, force=TRUE,
maptype="stamen_terrain_background")
stamen_map2 <- ggmap(stamen_study2)
map_study <- stamen_map +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
geom_point(data=pres.env,
aes(x=lon, y=lat),
colour="black", size=1.5, shape=21, fill="green") +
geom_point(data=pres.removed,
aes(x=lon, y=lat),
colour="red", size=2.5, shape=4) +
theme(axis.title = element_blank())
map_study
map_study2 <- stamen_map2 +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
geom_point(data=pres.env,
aes(x=lon, y=lat),
colour="black", size=2.0, shape=21, fill="green") +
geom_point(data=pres.removed,
aes(x=lon, y=lat),
colour="red", alpha=0.5, size=3.0, shape=4, stroke=2) +
theme(axis.title = element_blank())
map_study2
Background observations are selected within circular neighbourhoods of 500 km. This can be done via dismo::circles.
circles.model <- dismo::circles(p=pres.env,
d=500000,
lonlat=TRUE)
circles.predicted <- predict(circles.model,
predictors.raster[[1]])
The circular neighbourhoods include areas from the ocean.
circles.data <- as.data.frame(circles.predicted,
xy=TRUE,
na.rm=TRUE)
map_study2 <- stamen_map2 +
geom_contour_filled(data=circles.data,
aes(x=x, y=y, z=layer),
colour="black", alpha=0.4, show.legend=FALSE) +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
geom_point(data=pres.env,
aes(x=lon, y=lat),
colour="black", size=2.0, shape=21, fill="red") +
theme(axis.title = element_blank())
map_study2
Background locations are selected that satisfy two criteria: (i) to be within the circular neighbourhoods; and (ii) to be in terrestrial locations. The final number of background locations is 10 times larger than the number of occurrence records as used in several studies.
background1 <- dismo::randomPoints(mask=circles.predicted,
n=2000,
p=pres.env,
excludep=TRUE)
time1 <- Sys.time() # compare afterwards with terra::extract
background1.data <- raster::extract(predictors.raster, y=background1)
time2 <- Sys.time()
time.raster <- time2-time1
time.raster
## Time difference of 0.2208588 secs
background2 <- background1[complete.cases(background1.data), ]
background3 <- background2[sample(nrow(background2),
size=10*nrow(pres.env)), ]
background3 <- data.frame(background3)
nrow(background3)
## [1] 900
nrow(background3) / nrow(pres.env)
## [1] 10
names(background3) <- c("lon", "lat")
The following script compares the time required for extraction by terra with the time for raster:
time1 <- Sys.time()
background1.data <- terra::extract(predictors.terra, y=background1)
time2 <- Sys.time()
time.terra <- time2-time1
time.terra
## Time difference of 0.03476596 secs
time.terra - time.raster
## Time difference of -0.1860929 secs
as.numeric(time.terra) / as.numeric(time.raster)
## [1] 0.1574126
We have achieved our goal now of selecting the background locations.
terrestrial.raster <- predictors.raster[[1]] < Inf
names(terrestrial.raster) <- "terrestrial"
terrestrial.data <- as.data.frame(terrestrial.raster,
xy=TRUE,
na.rm=TRUE)
terrestrial.data$terrestrial <- as.numeric(terrestrial.data$terrestrial)
map_study <- stamen_map +
geom_contour_filled(data=terrestrial.data,
aes(x=x, y=y, z=terrestrial),
alpha=0.0, colour="black", show.legend=FALSE) +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
geom_point(data=background3,
aes(x=lon, y=lat),
colour="black", size=1, shape=21, fill="red") +
theme(axis.title = element_blank())
map_study
bio5.data <- as.data.frame(predictors.raster[["bio5"]],
xy=TRUE,
na.rm=TRUE)
bio5.data$bio5 <- bio5.data$bio5 / 10
map_study2 <- stamen_map2 +
geom_contour_filled(data=terrestrial.data,
aes(x=x, y=y, z=terrestrial),
alpha=0.0, colour="black", show.legend=FALSE) +
geom_contour_filled(data=bio5.data,
aes(x=x, y=y, z=bio5),
alpha=0.5, colour=NA, show.legend=TRUE) +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
geom_point(data=background3,
aes(x=lon, y=lat),
colour="black", size=1.5, shape=21, fill="red") +
theme(axis.title = element_blank())
map_study2
## Warning: Contour data has duplicated x, y coordinates.
## ℹ 4176 duplicated rows have been dropped.
## Warning: Removed 112 rows containing non-finite outside the scale range
## (`stat_contour_filled()`).
## Warning: Contour data has duplicated x, y coordinates.
## ℹ 4176 duplicated rows have been dropped.
## Warning: Removed 112 rows containing non-finite outside the scale range
## (`stat_contour_filled()`).
bio5.rast <- terra::crop(predictors.terra[["bio5"]]/10,
y=c(bbox_study2["left"], bbox_study2["right"],
bbox_study2["bottom"], bbox_study2["top"]))
terra::plot(bio5.rast)
points(background3, cex=0.8, pch=21, bg="red")
Now that we have occurrence and background locations, these data are divided in four spatial folds that will be used in a 4-fold cross-validation procedure afterwards (see Valavi et al. 2018: BOX 1) for more details). Ideally, spatial folding is done with an equal-area projection such as Mollweide’s. However, using the function with latitude-longitude data will still achieve the main goal of creating spatial folds where auto-correlation between calibration and evaluation data was reduced.
The spatial folding is done via BiodiversityR::ensemble.spatialBlock, a function that uses functions from the blockCV package internally.
locations.folded <- BiodiversityR::ensemble.spatialBlock(x=predictors.raster,
p=pres.env,
a=background3,
size=500000,
return.object=TRUE,
hexagon=FALSE,
progress=FALSE)
##
##
##
## train_0 train_1 test_0 test_1
## 1 675 59 225 31
## 2 674 72 226 18
## 3 676 74 224 16
## 4 675 65 225 25
The result includes the assignment to the spatial fold for the presence observations (‘groupp’) and the background locations (‘groupa’).
pres.folded <- data.frame(pres.env,
fold=as.character(locations.folded$k$groupp))
background.folded <- data.frame(background3,
fold=as.character(locations.folded$k$groupa))
map_study2 <- stamen_map2 +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
geom_point(data=pres.folded,
aes(x=lon, y=lat, fill=fold),
colour="black", size=2, shape=21) +
theme(axis.title = element_blank())
map_study2
map_study2 <- stamen_map2 +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
geom_point(data=background.folded,
aes(x=lon, y=lat, fill=fold),
colour="black", size=1.2, shape=21) +
theme(axis.title = element_blank())
map_study2
We now have processed all the data required for species distribution modelling. The functions of BiodiversityR::ensemble.calibrate.weights and BiodiversityR::ensemble.calibrate.models calibrate an ensemble model where
Although we are using a terra::SpatRaster as input, internally the functions will use a raster::rasterStack object. This is for several reasons, such as compatibility with dismo::prepareData and various data checking protocols, typically for categorical environmental variables. Note further that model calibrations are done internally via data.frames.
The textual output from the functions is quite substantial. With argument SINK=FALSE, a user can opt to capture this output in a text file.
# step 1: determine weights through 4-fold cross-validation
ensemble.calibrate.step1 <- ensemble.calibrate.weights(
x=predictors.terra, p=pres.env, a=background3,
k=locations.folded$k,
SINK=FALSE, species.name="Bradypus",
MAXENT=0, MAXNET=1, MAXLIKE=1, GBM=0, GBMSTEP=1, RF=1, CF=0,
GLM=1, GLMSTEP=1, GAM=1, GAMSTEP=1, MGCV=1, MGCVFIX=0,
EARTH=1, RPART=1, NNET=1, FDA=1, SVM=1, SVME=1, GLMNET=1,
BIOCLIM.O=0, BIOCLIM=1, DOMAIN=1, MAHAL=1, MAHAL01=0,
ENSEMBLE.tune=TRUE, PROBIT=TRUE,
ENSEMBLE.best=0, ENSEMBLE.exponent=c(1, 1.5, 2),
ENSEMBLE.min=0.55,
Yweights="BIOMOD",
PLOTS=FALSE, formulae.defaults=TRUE)
##
## NOTE: raster procedures will be done via the raster package, not terra
## This also allows usage of dismo::prepareData internally.
##
##
## Bradypus 4-FOLD CROSS-VALIDATION RUN: 1
##
## NOTE: raster procedures will be done via the raster package, not terra
## This also allows usage of dismo::prepareData internally.
## Loading required namespace: maxnet
## Loading required namespace: maxlike
## Loading required namespace: glmnet
##
## Spatial sorting bias (dismo package, no bias=1, extreme bias=0): 0.722337499264618
##
## Summary of Training data set used for calibrations (rows: 734)
## pb bio5 bio6 bio16
## Min. :0.00000 Min. :100.0 Min. :-98.0 Min. : 4.0
## 1st Qu.:0.00000 1st Qu.:303.0 1st Qu.:151.2 1st Qu.: 621.5
## Median :0.00000 Median :319.0 Median :191.0 Median : 841.0
## Mean :0.08038 Mean :307.4 Mean :169.4 Mean : 804.3
## 3rd Qu.:0.00000 3rd Qu.:329.0 3rd Qu.:208.0 3rd Qu.: 963.0
## Max. :1.00000 Max. :362.0 Max. :236.0 Max. :2426.0
## bio17
## Min. : 0.0
## 1st Qu.: 73.0
## Median : 161.5
## Mean : 216.3
## 3rd Qu.: 305.8
## Max. :1496.0
##
## 'data.frame': 734 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 306 312 299 342 313 255 310 329 206 224 ...
## $ bio6 : num 220 218 195 227 165 141 182 227 91 111 ...
## $ bio16: num 739 2426 1381 1072 540 ...
## $ bio17: num 222 1496 234 207 130 ...
##
## Summary of Testing data set used for evaluations (rows: 256)
## pb bio5 bio6 bio16
## Min. :0.0000 Min. :152.0 Min. :-70.0 Min. : 252.0
## 1st Qu.:0.0000 1st Qu.:313.0 1st Qu.:150.0 1st Qu.: 698.5
## Median :0.0000 Median :326.0 Median :197.5 Median : 878.5
## Mean :0.1211 Mean :315.8 Mean :176.4 Mean : 891.3
## 3rd Qu.:0.0000 3rd Qu.:331.0 3rd Qu.:213.0 3rd Qu.:1031.8
## Max. :1.0000 Max. :347.0 Max. :232.0 Max. :2458.0
## bio17
## Min. : 4.00
## 1st Qu.: 79.75
## Median :156.00
## Mean :197.69
## 3rd Qu.:269.25
## Max. :937.00
##
## 'data.frame': 256 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 329 327 326 246 337 335 325 333 324 340 ...
## $ bio6 : num 150 220 154 131 199 231 185 219 212 207 ...
## $ bio16: num 1547 807 1081 1240 531 ...
## $ bio17: num 373 281 280 269 88 208 90 196 122 64 ...
## Warning in dismo::randomPoints(x[[1]], n = MAXENT.an, p = p, excludep = T):
## generated random points = 0.9716 times requested number
##
## Summary of Training data set used for calibration of MAXENT or MAXLIKE model (rows: 9775, presence locations: 59)
## bio5 bio6 bio16 bio17
## Min. : 61.0 Min. :-212.00 Min. : 0.0 Min. : 0.0
## 1st Qu.:298.0 1st Qu.: 10.00 1st Qu.: 282.0 1st Qu.: 30.0
## Median :320.0 Median : 113.00 Median : 485.0 Median : 84.0
## Mean :305.4 Mean : 93.78 Mean : 543.5 Mean : 138.4
## 3rd Qu.:334.0 3rd Qu.: 183.00 3rd Qu.: 810.0 3rd Qu.: 213.0
## Max. :422.0 Max. : 242.00 Max. :2458.0 Max. :1496.0
##
## 1. Maximum entropy algorithm (package: maxnet)
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 831.865957822085
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.7708475
## cor : 0.2821822
## max TPR+TNR at : 0.5771537
##
## Threshold (method: spec_sens)
## [1] 0.5771537
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6650896
## cor : 0.1990558
## max TPR+TNR at : 0.5668278
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.57715366 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6650896 0.3105376 0.8695059 0.2916129 0.4302755 0.5483871 0.2070312
## AUCdiff Tjur
## 0.1057579 0.1309876
##
## 2. Maxlike algorithm (package: maxlike)
##
## Evaluation with calibration data of other algorithms
##
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 910.231050031387
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.745838
## cor : 0.2701147
## max TPR+TNR at : 0.4005952
##
## Threshold (method: spec_sens)
## [1] 0.4005952
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6722581
## cor : 0.2067952
## max TPR+TNR at : 0.3331744
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.4005952 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.67225806 0.27326165 0.86785648 0.14078853 0.20652064 0.29032258 0.53515625
## AUCdiff Tjur
## 0.07357998 0.08392629
##
## 3. gbm step algorithm (package: dismo)
## Loading required namespace: gbm
##
##
## GBM STEP - version 2.9
##
## Performing cross-validation optimisation of a boosted regression tree model
## for pb and using a family of bernoulli
## Using 734 observations and 4 predictors
## creating 10 initial models of 50 trees
##
## folds are stratified by prevalence
## total mean deviance = 0.2229
## tolerance is fixed at 2e-04
## now adding trees...
## restart model with a smaller learning rate or smaller step size...
## WARNING: stepwise GBM calibration failed
##
##
## 4. Random forest algorithm (package: randomForest)
## Warning in randomForest.default(m, y, ...): The response has five or fewer
## unique values. Are you sure you want to do regression?
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1.47315010419999e-07
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 1
## cor : 1
## max TPR+TNR at : 0.9999
##
## Threshold (method: spec_sens)
## [1] 0.9999
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.5507527
## cor : 0.1722997
## max TPR+TNR at : 0.9980398
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.9999 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.55075269 0.10236559 0.28913967 0.07010753 0.22398192 0.90322581 0.13281250
## AUCdiff Tjur
## 0.44924731 0.10230559
##
## 5. Generalized Linear Model
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 818.322394400013
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.7798619
## cor : 0.2890296
## max TPR+TNR at : 0.4364889
##
## Threshold (method: spec_sens)
## [1] 0.4364889
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6789964
## cor : 0.2119211
## max TPR+TNR at : 0.5181804
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.43648891 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6789964 0.2972043 0.8886651 0.1306093 0.1872486 0.4516129 0.4218750
## AUCdiff Tjur
## 0.1008655 0.1499597
##
## 6. Stepwise Generalized Linear Model
##
## stepwise GLM formula
##
## pb ~ bio5 + bio6 + I(bio6^2)
## <environment: 0x000002f21c9d1da0>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 851.956647650779
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.770408
## cor : 0.2567534
## max TPR+TNR at : 0.560482
##
## Threshold (method: spec_sens)
## [1] 0.560482
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6711111
## cor : 0.1947207
## max TPR+TNR at : 0.1677869
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.56048196 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.67111111 0.25992832 0.86950593 0.19039427 0.29708912 0.64516129 0.22265625
## AUCdiff Tjur
## 0.09929692 0.13170578
##
## 7. Generalized Additive Model (package: gam)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 867.050901461152
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.7505336
## cor : 0.2437555
## max TPR+TNR at : 0.4919894
##
## Threshold (method: spec_sens)
## [1] 0.4919894
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6762724
## cor : 0.1772771
## max TPR+TNR at : 0.6552244
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.49198943 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.67627240 0.28931900 0.87428644 0.19297491 0.27652813 0.32258065 0.46484375
## AUCdiff Tjur
## 0.07426118 0.12812755
##
## 8. Stepwise Generalized Additive Model (package: gam)
##
## stepwise GAM formula (gam package)
##
## pb ~ bio5 + bio6 + bio16
## <environment: 0x000002f21c9d1da0>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 867.779831593461
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.7513873
## cor : 0.2430603
## max TPR+TNR at : 0.51415
##
## Threshold (method: spec_sens)
## [1] 0.51415
##
## Evaluation with test data
##
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6724014
## cor : 0.1728068
## max TPR+TNR at : 0.6415424
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.51414997 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.67240143 0.27154122 0.87582721 0.19182796 0.27359418 0.35483871 0.44140625
## AUCdiff Tjur
## 0.07898589 0.12270174
##
## 9. Generalized Additive Model (package: mgcv)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 839.431921622686
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.770521
## cor : 0.2695972
## max TPR+TNR at : 0.5529154
##
## Threshold (method: spec_sens)
## [1] 0.5529154
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6765591
## cor : 0.192496
## max TPR+TNR at : 0.5809196
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.55291545 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.67655914 0.31498208 0.88317364 0.22164875 0.32010174 0.51612903 0.29296875
## AUCdiff Tjur
## 0.09396189 0.13550622
##
## 10. Multivariate Adaptive Regression Splines (package: earth)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 800.890241609315
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.806177
## cor : 0.3948295
## max TPR+TNR at : 0.4173563
##
## Threshold (method: spec_sens)
## [1] 0.4173563
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.588172
## cor : 0.1498531
## max TPR+TNR at : 0.452206
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.4173563 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.58817204 0.22150538 0.35072747 0.18150538 0.28220090 0.64516129 0.23046875
## AUCdiff Tjur
## 0.21800498 0.06898171
##
## 11. Recursive Partitioning And Regression Trees (package: rpart)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 353.360656397501
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.9598242
## cor : 0.6246081
## max TPR+TNR at : 0.687934
##
## Threshold (method: spec_sens)
## [1] 0.687934
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.5857348
## cor : 0.161115
## max TPR+TNR at : 0.8204845
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.68793395 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.5857348 0.1825090 0.3476189 0.1569892 0.2616533 0.7096774 0.2031250
## AUCdiff Tjur
## 0.3740895 0.1475570
##
## 12. Artificial Neural Network (package: nnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 847.112779733734
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.7227872
## cor : 0.2696118
## max TPR+TNR at : 0.7003786
##
## Threshold (method: spec_sens)
## [1] 0.7003786
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6865233
## cor : 0.2129518
## max TPR+TNR at : 0.4475324
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.70037863 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6865233 0.2788530 0.8627251 0.1403584 0.2217588 0.6774194 0.2421875
## AUCdiff Tjur
## 0.0362639 0.1399107
##
## 13. Flexible Discriminant Analysis (package: mda)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 925.894922945164
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.7608537
## cor : 0.3187795
## max TPR+TNR at : 0.4395161
##
## Threshold (method: spec_sens)
## [1] 0.4395161
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6647312
## cor : 0.2113111
## max TPR+TNR at : 0.400831
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.43951608 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.66473118 0.25204301 0.85348550 0.18394265 0.26248845 0.45161290 0.37500000
## AUCdiff Tjur
## 0.09612255 0.06869880
##
## 14. Support Vector Machines (package: kernlab)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 733.378034734897
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.9189579
## cor : 0.5784743
## max TPR+TNR at : 0.4084558
##
## Threshold (method: spec_sens)
## [1] 0.4084558
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.5736201
## cor : 0.1533726
## max TPR+TNR at : 0.4326645
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.40845578 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.57362007 0.23598566 0.65534784 0.20043011 0.30456786 0.61290323 0.23828125
## AUCdiff Tjur
## 0.34533787 0.09419779
##
## 15. Support Vector Machines (package: e1071)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 977.746558978515
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.629705
## cor : 0.1246044
## max TPR+TNR at : 0.5124224
##
## Threshold (method: spec_sens)
## [1] 0.5124224
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.5782079
## cor : 0.08888916
## max TPR+TNR at : 0.5129958
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.51242238 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.57820789 0.17161290 0.79167734 0.16272401 0.23725623 0.54838710 0.32031250
## AUCdiff Tjur
## 0.05149707 0.02010902
##
## 16. GLM with lasso or elasticnet regularization (package: glmnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 865.978273230495
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.7497301
## cor : 0.2449725
## max TPR+TNR at : 0.5324663
##
## Threshold (method: spec_sens)
## [1] 0.5324663
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.674552
## cor : 0.1764111
## max TPR+TNR at : 0.6751279
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.53246627 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6745520 0.2881720 0.8661773 0.1640143 0.2344244 0.3870968 0.4414062
## AUCdiff Tjur
## 0.0751781 0.1261319
##
## 17. BIOCLIM algorithm (package: dismo)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1011.27291705281
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.5677464
## cor : 0.05056276
## max TPR+TNR at : 0.465969
##
## Threshold (method: spec_sens)
## [1] 0.465969
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.5464516
## cor : 0.04621218
## max TPR+TNR at : 0.484264
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.46596904 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.546451613 0.138494624 0.199652180 0.017491039 0.027398020 0.258064516
## MCR.fixed AUCdiff Tjur
## 0.667968750 0.021294778 0.005188827
##
## 18. DOMAIN algorithm (package: dismo)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1005.801953175
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.5266918
## cor : 0.06238784
## max TPR+TNR at : 0.4745298
##
## Threshold (method: spec_sens)
## [1] 0.4745298
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.586595
## cor : 0.1173829
## max TPR+TNR at : 0.4930775
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.47452978 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.58659498 0.20659498 0.76953067 0.15326165 0.30486225 0.06451613
## MCR.fixed AUCdiff Tjur
## 0.69531250 -0.05990321 0.02386289
##
## 19. Mahalanobis algorithm (package: dismo)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1.62675354148148e-07
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 1
## cor : 1
## max TPR+TNR at : 0.9999
##
## Threshold (method: spec_sens)
## [1] 0.9999
##
## Evaluation with test data
## Warning in cor(x, y): the standard deviation is zero
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.5
## cor : NA
## max TPR+TNR at : -1e-04
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.9999 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.5 0.0 0.0 NA NA NA NA
## AUCdiff Tjur
## 0.5 0.0
##
## Weights tuned by ensemble.strategy function
## Warning in cor(x, y): the standard deviation is zero
##
## Ensemble tuning result: best=0, exponent=1, min=0.55
##
## Weights corresponding to best strategy
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.065195 0.065897 0.000000 0.000000 0.053987 0.000000 0.066558
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.065785 0.066291 0.065912 0.066319 0.000000 0.057655 0.057416 0.067296
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.065160 0.056229 0.056678 0.066122 0.000000 0.000000 0.057500 0.000000
## MAHAL01
## 0.000000
##
## Minimum input weight is 0.05
##
## Weights for ensemble forecasting
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.065195 0.065897 0.000000 0.000000 0.053987 0.000000 0.066558
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.065785 0.066291 0.065912 0.066319 0.000000 0.057655 0.057416 0.067296
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.065160 0.056229 0.056678 0.066122 0.000000 0.000000 0.057500 0.000000
## MAHAL01
## 0.000000
##
##
## 20. Ensemble algorithm
##
## Ensemble evaluation with calibration data
##
## Residual deviance (dismo package): 707.265792558381
## Residual deviance if all predictions were 0.0803814713896458 (prevalence): 410.599702947319
## Residual deviance for worst possible predictions: 30421.7542868179
##
## class : ModelEvaluation
## n presences : 59
## n absences : 675
## AUC : 0.907897
## cor : 0.4652241
## max TPR+TNR at : 0.5108404
##
## Threshold (method: spec_sens)
## [1] 0.5108404
##
## Ensemble evaluation with testing data
##
## class : ModelEvaluation
## n presences : 31
## n absences : 225
## AUC : 0.6781362
## cor : 0.2329349
## max TPR+TNR at : 0.2470232
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.51084035 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6781362 0.2877419 0.8788349 0.2170609 0.3428949 0.6451613 0.1992188
## AUCdiff Tjur
## 0.2297608 0.1062963
##
##
##
## finished model calibrations (function ensemble.calibrate.models)
##
## Bradypus 4-FOLD CROSS-VALIDATION RUN: 2
##
## NOTE: raster procedures will be done via the raster package, not terra
## This also allows usage of dismo::prepareData internally.
##
##
##
## Spatial sorting bias (dismo package, no bias=1, extreme bias=0): 0.77301792322704
##
## Summary of Training data set used for calibrations (rows: 746)
## pb bio5 bio6 bio16
## Min. :0.00000 Min. :100.0 Min. :-82.0 Min. : 4.0
## 1st Qu.:0.00000 1st Qu.:307.0 1st Qu.:154.0 1st Qu.: 689.0
## Median :0.00000 Median :323.0 Median :191.5 Median : 858.5
## Mean :0.09651 Mean :311.3 Mean :174.2 Mean : 857.9
## 3rd Qu.:0.00000 3rd Qu.:330.0 3rd Qu.:211.0 3rd Qu.: 981.0
## Max. :1.00000 Max. :362.0 Max. :233.0 Max. :2458.0
## bio17
## Min. : 0.00
## 1st Qu.: 81.25
## Median : 156.00
## Mean : 194.85
## 3rd Qu.: 268.00
## Max. :1496.00
##
## 'data.frame': 746 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 329 306 327 312 326 246 299 337 335 325 ...
## $ bio6 : num 150 220 220 218 154 131 195 199 231 185 ...
## $ bio16: num 1547 739 807 2426 1081 ...
## $ bio17: num 373 222 281 1496 280 ...
##
## Summary of Testing data set used for evaluations (rows: 244)
## pb bio5 bio6 bio16
## Min. :0.00000 Min. :135.0 Min. :-98.0 Min. : 86.0
## 1st Qu.:0.00000 1st Qu.:304.8 1st Qu.:142.0 1st Qu.: 440.5
## Median :0.00000 Median :316.0 Median :197.5 Median : 820.0
## Mean :0.07377 Mean :304.1 Mean :162.2 Mean : 731.7
## 3rd Qu.:0.00000 3rd Qu.:327.2 3rd Qu.:208.0 3rd Qu.: 959.8
## Max. :1.00000 Max. :356.0 Max. :236.0 Max. :1548.0
## bio17
## Min. : 0.00
## 1st Qu.: 58.75
## Median :176.50
## Mean :262.37
## 3rd Qu.:484.50
## Max. :766.00
##
## 'data.frame': 244 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 310 298 319 247 320 283 314 320 318 283 ...
## $ bio6 : num 182 185 205 125 214 156 206 206 205 171 ...
## $ bio16: num 865 1057 1040 559 872 ...
## $ bio17: num 314 658 405 182 498 32 667 554 607 766 ...
## Warning in dismo::randomPoints(x[[1]], n = MAXENT.an, p = p, excludep = T):
## generated random points = 0.9703 times requested number
##
## Summary of Training data set used for calibration of MAXENT or MAXLIKE model (rows: 9775, presence locations: 72)
## bio5 bio6 bio16 bio17
## Min. : 61.0 Min. :-212.00 Min. : 0.0 Min. : 0.0
## 1st Qu.:298.0 1st Qu.: 10.00 1st Qu.: 282.0 1st Qu.: 30.0
## Median :320.0 Median : 113.00 Median : 485.0 Median : 84.0
## Mean :305.4 Mean : 93.78 Mean : 543.5 Mean : 138.4
## 3rd Qu.:334.0 3rd Qu.: 183.00 3rd Qu.: 810.0 3rd Qu.: 213.0
## Max. :422.0 Max. : 242.00 Max. :2458.0 Max. :1496.0
##
## 1. Maximum entropy algorithm (package: maxnet)
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 848.473467339029
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7740068
## cor : 0.2973707
## max TPR+TNR at : 0.4865626
##
## Threshold (method: spec_sens)
## [1] 0.4865626
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6103736
## cor : 0.1367823
## max TPR+TNR at : 0.2555931
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.48656264 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.61037365 0.26745329 0.85503763 0.07079646 0.10208294 0.50000000 0.43442623
## AUCdiff Tjur
## 0.16363311 0.11326693
##
## 2. Maxlike algorithm (package: maxlike)
##
## Evaluation with calibration data of other algorithms
##
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 961.285484433786
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7216864
## cor : 0.2678448
## max TPR+TNR at : 0.4870436
##
## Threshold (method: spec_sens)
## [1] 0.4870436
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.640118
## cor : 0.1579717
## max TPR+TNR at : 0.4171388
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.48704363 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.64011799 0.33136676 0.87845431 0.06489676 0.13014548 0.83333333 0.15573770
## AUCdiff Tjur
## 0.08156845 0.03565918
##
## 3. gbm step algorithm (package: dismo)
##
##
## GBM STEP - version 2.9
##
## Performing cross-validation optimisation of a boosted regression tree model
## for pb and using a family of bernoulli
## Using 746 observations and 4 predictors
## creating 10 initial models of 50 trees
##
## folds are stratified by prevalence
## total mean deviance = 0.2676
## tolerance is fixed at 3e-04
## now adding trees...
## restart model with a smaller learning rate or smaller step size...
## WARNING: stepwise GBM calibration failed
##
##
## 4. Random forest algorithm (package: randomForest)
## Warning in randomForest.default(m, y, ...): The response has five or fewer
## unique values. Are you sure you want to do regression?
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1.51190891148668e-07
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 1
## cor : 1
## max TPR+TNR at : 0.9999
##
## Threshold (method: spec_sens)
## [1] 0.9999
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.5575221
## cor : 0.0867824
## max TPR+TNR at : 0.00117016
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.9999 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.55752212 0.15585054 0.30663035 0.02458210 0.09451260 0.94444444 0.09836066
## AUCdiff Tjur
## 0.44247788 0.06529054
##
## 5. Generalized Linear Model
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 872.158731987735
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7474242
## cor : 0.273382
## max TPR+TNR at : 0.6052888
##
## Threshold (method: spec_sens)
## [1] 0.6052888
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6750246
## cor : 0.1631373
## max TPR+TNR at : 0.4913004
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.60528881 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.67502458 0.30088496 0.88279135 0.14257620 0.27340944 0.77777778 0.13114754
## AUCdiff Tjur
## 0.07239959 0.12399116
##
## 6. Stepwise Generalized Linear Model
##
## stepwise GLM formula
##
## pb ~ bio5 + bio6 + I(bio16^3) + I(bio6^2)
## <environment: 0x000002f22905cdd0>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 892.137262449576
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7335559
## cor : 0.256786
## max TPR+TNR at : 0.5892266
##
## Threshold (method: spec_sens)
## [1] 0.5892266
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.7264012
## cor : 0.2209133
## max TPR+TNR at : 0.4959992
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.58922657 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.726401180 0.457718781 0.921694342 0.241396264 0.342194154 0.444444444
## MCR.fixed AUCdiff Tjur
## 0.323770492 0.007154705 0.184170840
##
## 7. Generalized Additive Model (package: gam)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 911.309017846323
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7298673
## cor : 0.2382069
## max TPR+TNR at : 0.6328411
##
## Threshold (method: spec_sens)
## [1] 0.6328411
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6617502
## cor : 0.1688434
## max TPR+TNR at : 0.4958248
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.63284113 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.66175025 0.35103245 0.88693789 0.06489676 0.13014548 0.83333333 0.15573770
## AUCdiff Tjur
## 0.06811705 0.12866453
##
## 8. Stepwise Generalized Additive Model (package: gam)
##
## stepwise GAM formula (gam package)
##
## pb ~ bio5 + bio6 + bio16 + bio17
## <environment: 0x000002f22905cdd0>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 911.309017846323
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7298673
## cor : 0.2382069
## max TPR+TNR at : 0.6328411
##
## Threshold (method: spec_sens)
## [1] 0.6328411
##
## Evaluation with test data
##
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6617502
## cor : 0.1688434
## max TPR+TNR at : 0.4958248
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.63284113 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.66175025 0.35103245 0.88693789 0.06489676 0.13014548 0.83333333 0.15573770
## AUCdiff Tjur
## 0.06811705 0.12866453
##
## 9. Generalized Additive Model (package: mgcv)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 886.607337555535
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7423961
## cor : 0.2635854
## max TPR+TNR at : 0.559059
##
## Threshold (method: spec_sens)
## [1] 0.559059
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.7241888
## cor : 0.2093141
## max TPR+TNR at : 0.4460824
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.55905901 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.72418879 0.40462144 0.90968668 0.23205506 0.34123202 0.55555556 0.23770492
## AUCdiff Tjur
## 0.01820735 0.15877492
##
## 10. Multivariate Adaptive Regression Splines (package: earth)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 791.982126514447
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.8386292
## cor : 0.4360794
## max TPR+TNR at : 0.3713189
##
## Threshold (method: spec_sens)
## [1] 0.3713189
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6558505
## cor : 0.08090292
## max TPR+TNR at : 0.3966226
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.3713189 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.65585054 0.38790560 0.81202662 0.32595870 0.45148796 0.33333333 0.34016393
## AUCdiff Tjur
## 0.18277870 0.06687103
##
## 11. Recursive Partitioning And Regression Trees (package: rpart)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 390.854559684491
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.955706
## cor : 0.6262101
## max TPR+TNR at : 0.4791612
##
## Threshold (method: spec_sens)
## [1] 0.4791612
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.4430924
## cor : -0.07006271
## max TPR+TNR at : 0.9416816
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.47916122 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.44309243 0.03785644 0.16903321 -0.12979351 -0.21042353 0.83333333
## MCR.fixed AUCdiff Tjur
## 0.33606557 0.51261356 -0.10697685
##
## 12. Artificial Neural Network (package: nnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 844.384890912213
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7521225
## cor : 0.3128546
## max TPR+TNR at : 0.6801849
##
## Threshold (method: spec_sens)
## [1] 0.6801849
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6864553
## cor : 0.1570737
## max TPR+TNR at : 0.3457327
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.6801849 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.68645526 0.27433628 0.88419383 0.12733530 0.21171244 0.72222222 0.19262295
## AUCdiff Tjur
## 0.06566723 0.13200031
##
## 13. Flexible Discriminant Analysis (package: mda)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 937.139504262388
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7888023
## cor : 0.3171746
## max TPR+TNR at : 0.4178506
##
## Threshold (method: spec_sens)
## [1] 0.4178506
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6821534
## cor : 0.2134407
## max TPR+TNR at : 0.491622
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.41785059 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.68215339 0.32055064 0.84914431 0.26597837 0.37361699 0.38888889 0.34836066
## AUCdiff Tjur
## 0.10664895 0.07956217
##
## 14. Support Vector Machines (package: kernlab)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 807.958241206256
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.8649439
## cor : 0.5171129
## max TPR+TNR at : 0.4179904
##
## Threshold (method: spec_sens)
## [1] 0.4179904
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.5319567
## cor : 0.04654897
## max TPR+TNR at : 0.4544508
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.41799037 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.53195674 0.17453294 0.68960881 0.02409046 0.03492953 0.55555556 0.43032787
## AUCdiff Tjur
## 0.33298721 0.02545061
##
## 15. Support Vector Machines (package: e1071)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 975.069679984576
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.6726426
## cor : 0.2234489
## max TPR+TNR at : 0.4946835
##
## Threshold (method: spec_sens)
## [1] 0.4946835
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6364307
## cor : 0.144944
## max TPR+TNR at : 0.4467976
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.49468347 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.63643068 0.34070796 0.90306975 0.12094395 0.18754703 0.66666667 0.24590164
## AUCdiff Tjur
## 0.03621192 0.07114206
##
## 16. GLM with lasso or elasticnet regularization (package: glmnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 911.408563806116
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.7295376
## cor : 0.2378567
## max TPR+TNR at : 0.5769954
##
## Threshold (method: spec_sens)
## [1] 0.5769954
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6647001
## cor : 0.1672578
## max TPR+TNR at : 0.4688739
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.57699542 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.66470010 0.34021632 0.88279135 0.15683382 0.22918051 0.55555556 0.30737705
## AUCdiff Tjur
## 0.06483749 0.12980401
##
## 17. BIOCLIM algorithm (package: dismo)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1034.12198481066
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.4738089
## cor : 0.004867208
## max TPR+TNR at : 0.4975711
##
## Threshold (method: spec_sens)
## [1] 0.4975711
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.4070796
## cor : -0.04811363
## max TPR+TNR at : 0.4985874
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.49757111 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.407079646 0.059488692 0.655054071 0.046214356 0.122755404 0.055555556
## MCR.fixed AUCdiff Tjur
## 0.836065574 0.066729289 -0.000561776
##
## 18. DOMAIN algorithm (package: dismo)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1027.21487365916
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.5064705
## cor : 0.05303145
## max TPR+TNR at : 0.4883422
##
## Threshold (method: spec_sens)
## [1] 0.4883422
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6092675
## cor : 0.1215436
## max TPR+TNR at : 0.495517
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.48834224 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.60926745 0.26941986 0.85115112 0.21189774 0.34925687 0.11111111
## MCR.fixed AUCdiff Tjur
## 0.63524590 -0.10279696 0.03176171
##
## 19. Mahalanobis algorithm (package: dismo)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1.64343455355234e-07
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 1
## cor : 1
## max TPR+TNR at : 0.9999
##
## Threshold (method: spec_sens)
## [1] 0.9999
##
## Evaluation with test data
## Warning in cor(x, y): the standard deviation is zero
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.5
## cor : NA
## max TPR+TNR at : -1e-04
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.9999 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.5 0.0 0.0 NA NA NA NA
## AUCdiff Tjur
## 0.5 0.0
##
## Weights tuned by ensemble.strategy function
## Warning in cor(x, y): the standard deviation is zero
##
## Ensemble tuning result: best=0, exponent=1, min=0.55
##
## Weights corresponding to best strategy
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.066403 0.069639 0.000000 0.000000 0.060653 0.000000 0.073436
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.079025 0.071992 0.071992 0.078785 0.000000 0.071350 0.000000 0.074680
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.074212 0.000000 0.069238 0.072313 0.000000 0.000000 0.066282 0.000000
## MAHAL01
## 0.000000
##
## Minimum input weight is 0.05
##
## Weights for ensemble forecasting
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.066403 0.069639 0.000000 0.000000 0.060653 0.000000 0.073436
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.079025 0.071992 0.071992 0.078785 0.000000 0.071350 0.000000 0.074680
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.074212 0.000000 0.069238 0.072313 0.000000 0.000000 0.066282 0.000000
## MAHAL01
## 0.000000
##
##
## 20. Ensemble algorithm
##
## Ensemble evaluation with calibration data
##
## Residual deviance (dismo package): 786.976610869998
## Residual deviance if all predictions were 0.096514745308311 (prevalence): 473.496484855909
## Residual deviance for worst possible predictions: 30919.1126668481
##
## class : ModelEvaluation
## n presences : 72
## n absences : 674
## AUC : 0.8636457
## cor : 0.4284273
## max TPR+TNR at : 0.5031389
##
## Threshold (method: spec_sens)
## [1] 0.5031389
##
## Ensemble evaluation with testing data
##
## class : ModelEvaluation
## n presences : 18
## n absences : 226
## AUC : 0.6769912
## cor : 0.1989654
## max TPR+TNR at : 0.4189872
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.50313885 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6769912 0.4090462 0.9064352 0.1671583 0.2876043 0.7222222 0.1557377
## AUCdiff Tjur
## 0.1866546 0.1056098
##
##
##
## finished model calibrations (function ensemble.calibrate.models)
##
## Bradypus 4-FOLD CROSS-VALIDATION RUN: 3
##
## NOTE: raster procedures will be done via the raster package, not terra
## This also allows usage of dismo::prepareData internally.
##
##
##
## Spatial sorting bias (dismo package, no bias=1, extreme bias=0): 0.763751992975507
##
## Summary of Training data set used for calibrations (rows: 750)
## pb bio5 bio6 bio16
## Min. :0.00000 Min. :135.0 Min. :-98.0 Min. : 86.0
## 1st Qu.:0.00000 1st Qu.:308.0 1st Qu.:155.2 1st Qu.: 646.0
## Median :0.00000 Median :322.0 Median :196.0 Median : 845.5
## Mean :0.09867 Mean :311.3 Mean :174.4 Mean : 822.1
## 3rd Qu.:0.00000 3rd Qu.:330.0 3rd Qu.:211.0 3rd Qu.: 978.8
## Max. :1.00000 Max. :362.0 Max. :236.0 Max. :2458.0
## bio17
## Min. : 0
## 1st Qu.: 75
## Median : 165
## Mean : 223
## 3rd Qu.: 318
## Max. :1496
##
## 'data.frame': 750 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 329 306 327 312 326 246 337 335 325 333 ...
## $ bio6 : num 150 220 220 218 154 131 199 231 185 219 ...
## $ bio16: num 1547 739 807 2426 1081 ...
## $ bio17: num 373 222 281 1496 280 ...
##
## Summary of Testing data set used for evaluations (rows: 240)
## pb bio5 bio6 bio16
## Min. :0.00000 Min. :100.0 Min. :-79.0 Min. : 4.0
## 1st Qu.:0.00000 1st Qu.:297.0 1st Qu.:137.8 1st Qu.: 684.8
## Median :0.00000 Median :317.0 Median :183.5 Median : 863.5
## Mean :0.06667 Mean :304.3 Mean :161.2 Mean : 841.3
## 3rd Qu.:0.00000 3rd Qu.:330.0 3rd Qu.:202.0 3rd Qu.: 976.5
## Max. :1.00000 Max. :359.0 Max. :226.0 Max. :2362.0
## bio17
## Min. : 0.0
## 1st Qu.: 78.5
## Median :145.0
## Mean :175.6
## 3rd Qu.:245.5
## Max. :979.0
##
## 'data.frame': 240 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 299 313 255 224 307 299 299 259 325 277 ...
## $ bio6 : num 195 165 141 111 202 204 217 86 187 160 ...
## $ bio16: num 1381 540 986 1168 1689 ...
## $ bio17: num 234 130 290 312 268 488 957 114 256 300 ...
## Warning in dismo::randomPoints(x[[1]], n = MAXENT.an, p = p, excludep = T):
## generated random points = 0.9701 times requested number
##
## Summary of Training data set used for calibration of MAXENT or MAXLIKE model (rows: 9775, presence locations: 74)
## bio5 bio6 bio16 bio17
## Min. : 61.0 Min. :-212.00 Min. : 0.0 Min. : 0.0
## 1st Qu.:298.0 1st Qu.: 10.00 1st Qu.: 282.0 1st Qu.: 30.0
## Median :320.0 Median : 113.00 Median : 485.0 Median : 84.0
## Mean :305.4 Mean : 93.78 Mean : 543.5 Mean : 138.4
## 3rd Qu.:334.0 3rd Qu.: 183.00 3rd Qu.: 810.0 3rd Qu.: 213.0
## Max. :422.0 Max. : 242.00 Max. :2458.0 Max. :1496.0
##
## 1. Maximum entropy algorithm (package: maxnet)
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 906.716641443883
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.7200944
## cor : 0.2425331
## max TPR+TNR at : 0.5969521
##
## Threshold (method: spec_sens)
## [1] 0.5969521
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.8236607
## cor : 0.3132909
## max TPR+TNR at : 0.5954526
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.59695208 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.8236607 0.5669643 0.8731000 0.5044643 0.6760854 0.3750000 0.1375000
## AUCdiff Tjur
## -0.1035664 0.2678538
##
## 2. Maxlike algorithm (package: maxlike)
##
## Evaluation with calibration data of other algorithms
##
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 975.959149791999
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.629238
## cor : 0.1580995
## max TPR+TNR at : 0.5534874
##
## Threshold (method: spec_sens)
## [1] 0.5534874
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.7452567
## cor : 0.168072
## max TPR+TNR at : 0.5885491
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.55348742 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.7452567 0.4553571 0.8538579 0.3883929 0.5308985 0.2500000 0.3541667
## AUCdiff Tjur
## -0.1160187 0.1213503
##
## 3. gbm step algorithm (package: dismo)
##
##
## GBM STEP - version 2.9
##
## Performing cross-validation optimisation of a boosted regression tree model
## for pb and using a family of bernoulli
## Using 750 observations and 4 predictors
## creating 10 initial models of 50 trees
##
## folds are stratified by prevalence
## total mean deviance = 0.2736
## tolerance is fixed at 3e-04
## now adding trees...
## restart model with a smaller learning rate or smaller step size...
## WARNING: stepwise GBM calibration failed
##
##
## 4. Random forest algorithm (package: randomForest)
## Warning in randomForest.default(m, y, ...): The response has five or fewer
## unique values. Are you sure you want to do regression?
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1.51529992783917e-07
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 1
## cor : 1
## max TPR+TNR at : 0.9999
##
## Threshold (method: spec_sens)
## [1] 0.9999
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.5456194
## cor : 0.152207
## max TPR+TNR at : 0.9998925
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.9999 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.54561942 0.10267857 0.30370950 0.10267857 0.30370950 0.87500000 0.07916667
## AUCdiff Tjur
## 0.45438058 0.10267786
##
## 5. Generalized Linear Model
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 901.389921082799
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.7287302
## cor : 0.2459025
## max TPR+TNR at : 0.5238007
##
## Threshold (method: spec_sens)
## [1] 0.5238007
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.7979911
## cor : 0.2742614
## max TPR+TNR at : 0.5946516
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.52380071 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.79799107 0.53571429 0.80299675 0.33928571 0.46853329 0.31250000
## MCR.fixed AUCdiff Tjur
## 0.34583333 -0.06926086 0.25729303
##
## 6. Stepwise Generalized Linear Model
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##
## stepwise GLM formula
##
## pb ~ bio5 + bio6 + I(bio6^2)
## <environment: 0x000002f229d5ac40>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 933.169627643651
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.7069107
## cor : 0.2102736
## max TPR+TNR at : 0.5577396
##
## Threshold (method: spec_sens)
## [1] 0.5577396
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.7903181
## cor : 0.2568268
## max TPR+TNR at : 0.6229178
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.55773964 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.7903181 0.5848214 0.8215029 0.5000000 0.6594007 0.3125000 0.1958333
## AUCdiff Tjur
## -0.0834074 0.2152036
##
## 7. Generalized Additive Model (package: gam)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 946.761318925071
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.6864705
## cor : 0.1970365
## max TPR+TNR at : 0.4894335
##
## Threshold (method: spec_sens)
## [1] 0.4894335
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.796596
## cor : 0.2814579
## max TPR+TNR at : 0.6425312
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.48943354 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.7965960 0.5758929 0.8557821 0.4375000 0.5875389 0.2500000 0.3083333
## AUCdiff Tjur
## -0.1101255 0.2008700
##
## 8. Stepwise Generalized Additive Model (package: gam)
##
## stepwise GAM formula (gam package)
##
## pb ~ bio5 + bio6 + bio16 + bio17
## <environment: 0x000002f229d5ac40>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 946.761318925071
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.6864705
## cor : 0.1970365
## max TPR+TNR at : 0.4894335
##
## Threshold (method: spec_sens)
## [1] 0.4894335
##
## Evaluation with test data
##
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.796596
## cor : 0.2814579
## max TPR+TNR at : 0.6425312
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.48943354 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.7965960 0.5758929 0.8557821 0.4375000 0.5875389 0.2500000 0.3083333
## AUCdiff Tjur
## -0.1101255 0.2008700
##
## 9. Generalized Additive Model (package: mgcv)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 911.154685070089
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.7174756
## cor : 0.2349738
## max TPR+TNR at : 0.5813571
##
## Threshold (method: spec_sens)
## [1] 0.5813571
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.8158482
## cor : 0.2997929
## max TPR+TNR at : 0.6312314
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.58135712 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.8158482 0.5848214 0.8242423 0.5357143 0.6993574 0.3125000 0.1625000
## AUCdiff Tjur
## -0.0983726 0.2641031
##
## 10. Multivariate Adaptive Regression Splines (package: earth)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 924.623038483
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.7264313
## cor : 0.2911124
## max TPR+TNR at : 0.4147149
##
## Threshold (method: spec_sens)
## [1] 0.4147149
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.7798549
## cor : 0.3534294
## max TPR+TNR at : 0.4531544
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.41471486 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.7798549 0.5133929 0.7466092 0.4553571 0.6126102 0.1875000 0.3458333
## AUCdiff Tjur
## -0.0534236 0.1971482
##
## 11. Recursive Partitioning And Regression Trees (package: rpart)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 451.828773932048
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.9388394
## cor : 0.5821263
## max TPR+TNR at : 0.5388234
##
## Threshold (method: spec_sens)
## [1] 0.5388234
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.6805246
## cor : 0.2022554
## max TPR+TNR at : 0.7314744
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.53882342 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6805246 0.3571429 0.4990674 0.3392857 0.4750237 0.4375000 0.2375000
## AUCdiff Tjur
## 0.2583148 0.3010842
##
## 12. Artificial Neural Network (package: nnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 915.741409305919
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.6793139
## cor : 0.2076946
## max TPR+TNR at : 0.4207085
##
## Threshold (method: spec_sens)
## [1] 0.4207085
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.6587612
## cor : 0.1385105
## max TPR+TNR at : 0.6550034
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.42070854 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.65876116 0.34375000 0.81273641 0.22767857 0.36276260 0.12500000 0.61250000
## AUCdiff Tjur
## 0.02055277 0.15946913
##
## 13. Flexible Discriminant Analysis (package: mda)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 952.317944199035
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.7163961
## cor : 0.2536989
## max TPR+TNR at : 0.4573293
##
## Threshold (method: spec_sens)
## [1] 0.4573293
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.8650949
## cor : 0.4309681
## max TPR+TNR at : 0.4962819
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.45732934 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.8650949 0.6651786 0.9306112 0.4955357 0.6548161 0.1875000 0.3083333
## AUCdiff Tjur
## -0.1486987 0.2351842
##
## 14. Support Vector Machines (package: kernlab)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 718.85005050806
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.8510715
## cor : 0.4652336
## max TPR+TNR at : 0.4946098
##
## Threshold (method: spec_sens)
## [1] 0.4946098
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.5492467
## cor : 0.08539346
## max TPR+TNR at : 0.6910093
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.49460984 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.54924665 0.28125000 0.41860682 0.16964286 0.24882106 0.56250000 0.28750000
## AUCdiff Tjur
## 0.30182483 0.09899723
##
## 15. Support Vector Machines (package: e1071)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 969.761211123304
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.6373741
## cor : 0.1815636
## max TPR+TNR at : 0.5245872
##
## Threshold (method: spec_sens)
## [1] 0.5245872
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.5811942
## cor : 0.1390348
## max TPR+TNR at : 0.5709948
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.52458721 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.58119420 0.34375000 0.75307054 0.28571429 0.42565768 0.56250000 0.17916667
## AUCdiff Tjur
## 0.05617986 0.08276210
##
## 16. GLM with lasso or elasticnet regularization (package: glmnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 947.071937028282
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.6838118
## cor : 0.1954378
## max TPR+TNR at : 0.4615629
##
## Threshold (method: spec_sens)
## [1] 0.4615629
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.8005022
## cor : 0.2778972
## max TPR+TNR at : 0.622636
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.46156288 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.8005022 0.5669643 0.8631012 0.3392857 0.4719617 0.2500000 0.4000000
## AUCdiff Tjur
## -0.1166905 0.2016912
##
## 17. BIOCLIM algorithm (package: dismo)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1036.68694432932
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.5613406
## cor : 0.03764289
## max TPR+TNR at : 0.4772784
##
## Threshold (method: spec_sens)
## [1] 0.4772784
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.4245257
## cor : -0.1202121
## max TPR+TNR at : 0.4696648
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.47727836 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.42452567 0.15625000 0.24318902 -0.04910714 -0.07082814 0.50000000
## MCR.fixed AUCdiff Tjur
## 0.54583333 0.13681489 -0.01889612
##
## 18. DOMAIN algorithm (package: dismo)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1019.22719355352
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.5657185
## cor : 0.08906799
## max TPR+TNR at : 0.4638702
##
## Threshold (method: spec_sens)
## [1] 0.4638702
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.3702567
## cor : -0.004192832
## max TPR+TNR at : 0.4064138
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.46387022 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.370256696 0.120535714 0.802996746 0.008928571 0.013475494 0.312500000
## MCR.fixed AUCdiff Tjur
## 0.654166667 0.195461759 -0.001926259
##
## 19. Mahalanobis algorithm (package: dismo)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1.98829819662085e-07
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 1
## cor : 1
## max TPR+TNR at : 0.9999
##
## Threshold (method: spec_sens)
## [1] 0.9999
##
## Evaluation with test data
## Warning in cor(x, y): the standard deviation is zero
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.5
## cor : NA
## max TPR+TNR at : -1e-04
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.9999 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.5 0.0 0.0 NA NA NA NA
## AUCdiff Tjur
## 0.5 0.0
##
## Weights tuned by ensemble.strategy function
## Warning in cor(x, y): the standard deviation is zero
##
## Ensemble tuning result: best=0, exponent=1, min=0.55
##
## Weights corresponding to best strategy
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.082928 0.075034 0.000000 0.000000 0.000000 0.000000 0.080344
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.079571 0.080203 0.080203 0.082142 0.000000 0.078518 0.068517 0.066326
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.087100 0.000000 0.058516 0.080597 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
##
## Minimum input weight is 0.05
##
## Weights for ensemble forecasting
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.082928 0.075034 0.000000 0.000000 0.000000 0.000000 0.080344
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.079571 0.080203 0.080203 0.082142 0.000000 0.078518 0.068517 0.066326
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.087100 0.000000 0.058516 0.080597 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
##
##
## 20. Ensemble algorithm
##
## Ensemble evaluation with calibration data
##
## Residual deviance (dismo package): 849.692662470305
## Residual deviance if all predictions were 0.0986666666666667 (prevalence): 483.21513719123
## Residual deviance for worst possible predictions: 31084.8987936568
##
## class : ModelEvaluation
## n presences : 74
## n absences : 676
## AUC : 0.810411
## cor : 0.317141
## max TPR+TNR at : 0.5335338
##
## Threshold (method: spec_sens)
## [1] 0.5335338
##
## Ensemble evaluation with testing data
##
## class : ModelEvaluation
## n presences : 16
## n absences : 224
## AUC : 0.8091518
## cor : 0.2999313
## max TPR+TNR at : 0.604403
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.53353385 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.809151786 0.611607143 0.836805115 0.500000000 0.659400722 0.312500000
## MCR.fixed AUCdiff Tjur
## 0.195833333 0.001259217 0.211297788
##
##
##
## finished model calibrations (function ensemble.calibrate.models)
##
## Bradypus 4-FOLD CROSS-VALIDATION RUN: 4
##
## NOTE: raster procedures will be done via the raster package, not terra
## This also allows usage of dismo::prepareData internally.
##
##
##
## Spatial sorting bias (dismo package, no bias=1, extreme bias=0): 0.562151431315052
##
## Summary of Training data set used for calibrations (rows: 740)
## pb bio5 bio6 bio16
## Min. :0.00000 Min. :100.0 Min. :-98.0 Min. : 4.0
## 1st Qu.:0.00000 1st Qu.:305.0 1st Qu.:144.8 1st Qu.: 639.5
## Median :0.00000 Median :320.0 Median :190.0 Median : 855.5
## Mean :0.08784 Mean :308.2 Mean :166.8 Mean : 822.4
## 3rd Qu.:0.00000 3rd Qu.:330.2 3rd Qu.:208.0 3rd Qu.: 992.0
## Max. :1.00000 Max. :359.0 Max. :236.0 Max. :2458.0
## bio17
## Min. : 0.00
## 1st Qu.: 72.75
## Median :158.00
## Mean :211.85
## 3rd Qu.:283.25
## Max. :979.00
##
## 'data.frame': 740 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 329 327 326 246 299 337 335 325 333 313 ...
## $ bio6 : num 150 220 154 131 195 199 231 185 219 165 ...
## $ bio16: num 1547 807 1081 1240 1381 ...
## $ bio17: num 373 281 280 269 234 88 208 90 196 130 ...
##
## Summary of Testing data set used for evaluations (rows: 250)
## pb bio5 bio6 bio16
## Min. :0.0 Min. :162.0 Min. :-82.0 Min. : 215.0
## 1st Qu.:0.0 1st Qu.:310.0 1st Qu.:178.0 1st Qu.: 686.5
## Median :0.0 Median :322.0 Median :195.0 Median : 834.0
## Mean :0.1 Mean :313.6 Mean :184.3 Mean : 839.6
## 3rd Qu.:0.0 3rd Qu.:329.0 3rd Qu.:215.0 3rd Qu.: 949.0
## Max. :1.0 Max. :362.0 Max. :233.0 Max. :2426.0
## bio17
## Min. : 0.00
## 1st Qu.: 93.25
## Median : 164.00
## Mean : 210.42
## 3rd Qu.: 288.25
## Max. :1496.00
##
## 'data.frame': 250 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 306 312 342 329 206 338 308 335 310 297 ...
## $ bio6 : num 220 218 227 227 91 191 197 216 218 196 ...
## $ bio16: num 739 2426 1072 877 360 ...
## $ bio17: num 222 1496 207 230 151 ...
## Warning in dismo::randomPoints(x[[1]], n = MAXENT.an, p = p, excludep = T):
## generated random points = 0.971 times requested number
##
## Summary of Training data set used for calibration of MAXENT or MAXLIKE model (rows: 9775, presence locations: 65)
## bio5 bio6 bio16 bio17
## Min. : 61.0 Min. :-212.00 Min. : 0.0 Min. : 0.0
## 1st Qu.:298.0 1st Qu.: 10.00 1st Qu.: 282.0 1st Qu.: 30.0
## Median :320.0 Median : 113.00 Median : 485.0 Median : 84.0
## Mean :305.4 Mean : 93.78 Mean : 543.5 Mean : 138.4
## 3rd Qu.:334.0 3rd Qu.: 183.00 3rd Qu.: 810.0 3rd Qu.: 213.0
## Max. :422.0 Max. : 242.00 Max. :2458.0 Max. :1496.0
##
## 1. Maximum entropy algorithm (package: maxnet)
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 839.117595699797
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7654245
## cor : 0.2871377
## max TPR+TNR at : 0.5820532
##
## Threshold (method: spec_sens)
## [1] 0.5820532
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.6396444
## cor : 0.1725976
## max TPR+TNR at : 0.593288
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.58205325 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6396444 0.2977778 0.7315698 0.2711111 0.3925748 0.5200000 0.2400000
## AUCdiff Tjur
## 0.1257801 0.1196320
##
## 2. Maxlike algorithm (package: maxlike)
##
## Evaluation with calibration data of other algorithms
##
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 925.871339069996
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7136866
## cor : 0.2711168
## max TPR+TNR at : 0.5480168
##
## Threshold (method: spec_sens)
## [1] 0.5480168
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.7054222
## cor : 0.2169598
## max TPR+TNR at : 0.5186058
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.54801678 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.705422222 0.413333333 0.849513286 0.297777778 0.443931940 0.560000000
## MCR.fixed AUCdiff Tjur
## 0.184000000 0.008264387 0.097663857
##
## 3. gbm step algorithm (package: dismo)
##
##
## GBM STEP - version 2.9
##
## Performing cross-validation optimisation of a boosted regression tree model
## for pb and using a family of bernoulli
## Using 740 observations and 4 predictors
## creating 10 initial models of 50 trees
##
## folds are stratified by prevalence
## total mean deviance = 0.2435
## tolerance is fixed at 2e-04
## now adding trees...
## restart model with a smaller learning rate or smaller step size...
## WARNING: stepwise GBM calibration failed
##
##
## 4. Random forest algorithm (package: randomForest)
## Warning in randomForest.default(m, y, ...): The response has five or fewer
## unique values. Are you sure you want to do regression?
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 6.23538581404475
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.9999772
## cor : 0.9923137
## max TPR+TNR at : 0.8902054
##
## Threshold (method: spec_sens)
## [1] 0.8902054
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.552
## cor : 0.1945923
## max TPR+TNR at : 0.9440723
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.89020543 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.5520000 0.1333333 0.3426970 0.1333333 0.3426970 0.8400000 0.1080000
## AUCdiff Tjur
## 0.4479772 0.1275054
##
## 5. Generalized Linear Model
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 844.97483145888
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7633048
## cor : 0.2814682
## max TPR+TNR at : 0.5806438
##
## Threshold (method: spec_sens)
## [1] 0.5806438
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.6691556
## cor : 0.2181087
## max TPR+TNR at : 0.5609836
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.5806438 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.66915556 0.33333333 0.84536076 0.32000000 0.45531672 0.48000000 0.22800000
## AUCdiff Tjur
## 0.09414929 0.14699582
##
## 6. Stepwise Generalized Linear Model
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##
## stepwise GLM formula
##
## pb ~ bio5 + bio6 + I(bio6^2) + I(bio16^3)
## <environment: 0x000002f211b748a8>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 865.95010282061
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7463248
## cor : 0.2597206
## max TPR+TNR at : 0.5257411
##
## Threshold (method: spec_sens)
## [1] 0.5257411
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.6839111
## cor : 0.2327769
## max TPR+TNR at : 0.5986708
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.52574105 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.68391111 0.42222222 0.86272513 0.27111111 0.38276254 0.44000000 0.30400000
## AUCdiff Tjur
## 0.06241368 0.14189134
##
## 7. Generalized Additive Model (package: gam)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 905.868186103963
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7168319
## cor : 0.2207563
## max TPR+TNR at : 0.6120143
##
## Threshold (method: spec_sens)
## [1] 0.6120143
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.7192889
## cor : 0.2297528
## max TPR+TNR at : 0.6081007
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.61201434 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.71928889 0.40444444 0.83406474 0.37777778 0.52732031 0.44000000
## MCR.fixed AUCdiff Tjur
## 0.20800000 -0.00245698 0.13349401
##
## 8. Stepwise Generalized Additive Model (package: gam)
##
## stepwise GAM formula (gam package)
##
## pb ~ bio5 + bio6 + bio16 + bio17
## <environment: 0x000002f211b748a8>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 905.868186103963
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7168319
## cor : 0.2207563
## max TPR+TNR at : 0.6120143
##
## Threshold (method: spec_sens)
## [1] 0.6120143
##
## Evaluation with test data
##
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.7192889
## cor : 0.2297528
## max TPR+TNR at : 0.6081007
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.61201434 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.71928889 0.40444444 0.83406474 0.37777778 0.52732031 0.44000000
## MCR.fixed AUCdiff Tjur
## 0.20800000 -0.00245698 0.13349401
##
## 9. Generalized Additive Model (package: mgcv)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 864.406493806102
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7442507
## cor : 0.261788
## max TPR+TNR at : 0.5603723
##
## Threshold (method: spec_sens)
## [1] 0.5603723
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.6748444
## cor : 0.2105567
## max TPR+TNR at : 0.6554711
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.56037225 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.67484444 0.38666667 0.82911806 0.32444444 0.45157524 0.40000000 0.28800000
## AUCdiff Tjur
## 0.06940627 0.13380698
##
## 10. Multivariate Adaptive Regression Splines (package: earth)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 833.538572740835
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7961937
## cor : 0.3912333
## max TPR+TNR at : 0.4256438
##
## Threshold (method: spec_sens)
## [1] 0.4256438
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.6579556
## cor : 0.1615126
## max TPR+TNR at : 0.4135646
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.42564382 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6579556 0.3244444 0.7315698 0.2933333 0.4099398 0.3200000 0.3800000
## AUCdiff Tjur
## 0.1382382 0.0682306
##
## 11. Recursive Partitioning And Regression Trees (package: rpart)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 389.163372208993
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.956547
## cor : 0.6115374
## max TPR+TNR at : 0.4694336
##
## Threshold (method: spec_sens)
## [1] 0.4694336
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.5023111
## cor : 0.01020133
## max TPR+TNR at : 0.9526902
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.46943364 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.50231111 0.10222222 0.32075751 -0.02666667 -0.04232192 0.76000000
## MCR.fixed AUCdiff Tjur
## 0.31600000 0.45423590 0.01211016
##
## 12. Artificial Neural Network (package: nnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 879.83214322788
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7093105
## cor : 0.2444149
## max TPR+TNR at : 0.7380311
##
## Threshold (method: spec_sens)
## [1] 0.7380311
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.5987556
## cor : 0.08886629
## max TPR+TNR at : 0.7986015
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.73803112 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.59875556 0.15111111 0.27867021 0.15111111 0.27867021 0.76000000 0.15600000
## AUCdiff Tjur
## 0.11055499 0.05344571
##
## 13. Flexible Discriminant Analysis (package: mda)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 941.918060061716
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7669516
## cor : 0.3210289
## max TPR+TNR at : 0.4269702
##
## Threshold (method: spec_sens)
## [1] 0.4269702
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.6210667
## cor : 0.201363
## max TPR+TNR at : 0.4765016
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.42697024 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.62106667 0.30222222 0.82653837 0.05333333 0.07919772 0.32000000 0.59600000
## AUCdiff Tjur
## 0.14588490 0.06771365
##
## 14. Support Vector Machines (package: kernlab)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 822.142663430793
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.8594872
## cor : 0.5014415
## max TPR+TNR at : 0.424352
##
## Threshold (method: spec_sens)
## [1] 0.424352
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.6103111
## cor : 0.1438575
## max TPR+TNR at : 0.4680302
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.42435196 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.61031111 0.25333333 0.82388189 0.18666667 0.27389265 0.56000000 0.28400000
## AUCdiff Tjur
## 0.24917607 0.06376407
##
## 15. Support Vector Machines (package: e1071)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 944.826929684922
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.638963
## cor : 0.2410887
## max TPR+TNR at : 0.5084146
##
## Threshold (method: spec_sens)
## [1] 0.5084146
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.5804444
## cor : 0.04346866
## max TPR+TNR at : 0.4988891
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.50841464 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.58044444 0.23555556 0.58566879 0.05777778 0.10432489 0.80000000 0.20800000
## AUCdiff Tjur
## 0.05851852 0.01790811
##
## 16. GLM with lasso or elasticnet regularization (package: glmnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 905.369445450766
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.7167179
## cor : 0.2215849
## max TPR+TNR at : 0.5949818
##
## Threshold (method: spec_sens)
## [1] 0.5949818
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.7150222
## cor : 0.2237228
## max TPR+TNR at : 0.6094181
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.59498184 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.715022222 0.417777778 0.843211343 0.373333333 0.515299869 0.400000000
## MCR.fixed AUCdiff Tjur
## 0.244000000 0.001695726 0.127570576
##
## 17. BIOCLIM algorithm (package: dismo)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1022.78132898858
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.5709288
## cor : 0.03627293
## max TPR+TNR at : 0.4639076
##
## Threshold (method: spec_sens)
## [1] 0.4639076
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.5128889
## cor : 0.01616317
## max TPR+TNR at : 0.4854708
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.46390762 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.512888889 0.133333333 0.257318805 -0.022222222 -0.042453603 0.160000000
## MCR.fixed AUCdiff Tjur
## 0.792000000 0.058039886 0.002090482
##
## 18. DOMAIN algorithm (package: dismo)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1008.58656622191
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.5362051
## cor : 0.07748878
## max TPR+TNR at : 0.4986688
##
## Threshold (method: spec_sens)
## [1] 0.4986688
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.4941333
## cor : -0.0296301
## max TPR+TNR at : 0.5201278
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.4986688 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.494133333 0.075555556 0.121861502 0.017777778 0.029876842 0.200000000
## MCR.fixed AUCdiff Tjur
## 0.724000000 0.042071795 -0.008485315
##
## 19. Mahalanobis algorithm (package: dismo)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1.55465621509574e-07
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 1
## cor : 1
## max TPR+TNR at : 0.9999
##
## Threshold (method: spec_sens)
## [1] 0.9999
##
## Evaluation with test data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.4977778
## cor : -0.02112414
## max TPR+TNR at : -1e-04
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.9999 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.497777778 0.000000000 0.000000000 NA NA NA
## MCR.fixed AUCdiff Tjur
## NA 0.502222222 -0.002025166
##
## Weights tuned by ensemble.strategy function
## Ensemble tuning result: best=0, exponent=1, min=0.55
##
## Weights corresponding to best strategy
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.069929 0.077120 0.000000 0.000000 0.060347 0.000000 0.073155
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.074768 0.078636 0.078636 0.073777 0.000000 0.071930 0.000000 0.065458
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.067898 0.066722 0.063457 0.078169 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
##
## Minimum input weight is 0.05
##
## Weights for ensemble forecasting
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.069929 0.077120 0.000000 0.000000 0.060347 0.000000 0.073155
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.074768 0.078636 0.078636 0.073777 0.000000 0.071930 0.000000 0.065458
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.067898 0.066722 0.063457 0.078169 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
##
##
## 20. Ensemble algorithm
##
## Ensemble evaluation with calibration data
##
## Residual deviance (dismo package): 769.301938014035
## Residual deviance if all predictions were 0.0878378378378378 (prevalence): 440.309797809011
## Residual deviance for worst possible predictions: 30670.4334768613
##
## class : ModelEvaluation
## n presences : 65
## n absences : 675
## AUC : 0.8597835
## cor : 0.4117357
## max TPR+TNR at : 0.509457
##
## Threshold (method: spec_sens)
## [1] 0.509457
##
## Ensemble evaluation with testing data
##
## class : ModelEvaluation
## n presences : 25
## n absences : 225
## AUC : 0.6940444
## cor : 0.2337803
## max TPR+TNR at : 0.5080288
##
## Results with ensemble.evaluate
##
## Calculated fixed threshold of 0.50945696 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6940444 0.3911111 0.8123807 0.3511111 0.4993628 0.4800000 0.2000000
## AUCdiff Tjur
## 0.1657390 0.1041881
##
##
##
## finished model calibrations (function ensemble.calibrate.models)
##
## Results of ensemble.calibrate.weights sorted by average AUC for tests T_1 to T_4
##
## columns T_1 to T_4 show the AUC for each 4-fold cross-validation run
## column MEAN.T shows the mean of the AUC
##
## columns S_1 to S_4 show the weights for the ensemble model with best AUC
## column MEAN shows the mean of these weights
##
## T_1 T_2 T_3 T_4 MEAN.T S_1 S_2
## MGCV 0.6765591 0.7241888 0.8158482 0.6748444 0.7228601 0.066319 0.078785
## GLMSTEP 0.6711111 0.7264012 0.7903181 0.6839111 0.7179354 0.065785 0.079025
## ENSEMBLE 0.6781362 0.6769912 0.8091518 0.6940444 0.7145809 0.000000 0.000000
## GLMNET 0.6745520 0.6647001 0.8005022 0.7150222 0.7136941 0.066122 0.072313
## GAM 0.6762724 0.6617502 0.7965960 0.7192889 0.7134769 0.066291 0.071992
## GAMSTEP 0.6724014 0.6617502 0.7965960 0.7192889 0.7125091 0.065912 0.071992
## FDA 0.6647312 0.6821534 0.8650949 0.6210667 0.7082615 0.065160 0.074212
## GLM 0.6789964 0.6750246 0.7979911 0.6691556 0.7052919 0.066558 0.073436
## MAXLIKE 0.6722581 0.6401180 0.7452567 0.7054222 0.6907637 0.065897 0.069639
## MAXNET 0.6650896 0.6103736 0.8236607 0.6396444 0.6846921 0.065195 0.066403
## EARTH 0.5881720 0.6558505 0.7798549 0.6579556 0.6704583 0.057655 0.071350
## NNET 0.6865233 0.6864553 0.6587612 0.5987556 0.6576238 0.067296 0.074680
## SVME 0.5782079 0.6364307 0.5811942 0.5804444 0.5940693 0.056678 0.069238
## SVM 0.5736201 0.5319567 0.5492467 0.6103111 0.5662836 0.056229 0.000000
## RPART 0.5857348 0.4430924 0.6805246 0.5023111 0.5529157 0.057416 0.000000
## RF 0.5507527 0.5575221 0.5456194 0.5520000 0.5514736 0.053987 0.060653
## DOMAIN 0.5865950 0.6092675 0.3702567 0.4941333 0.5150631 0.057500 0.066282
## MAHAL 0.5000000 0.5000000 0.5000000 0.4977778 0.4994444 0.000000 0.000000
## BIOCLIM 0.5464516 0.4070796 0.4245257 0.5128889 0.4727365 0.000000 0.000000
## MAXENT 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.000000 0.000000
## GBM 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.000000 0.000000
## GBMSTEP 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.000000 0.000000
## CF 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.000000 0.000000
## MGCVFIX 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.000000 0.000000
## BIOCLIM.O 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.000000 0.000000
## MAHAL01 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.000000 0.000000
## S_3 S_4 MEAN
## MGCV 0.082142 0.073777 0.07525575
## GLMSTEP 0.079571 0.074768 0.07478725
## ENSEMBLE 0.000000 0.000000 0.00000000
## GLMNET 0.080597 0.078169 0.07430025
## GAM 0.080203 0.078636 0.07428050
## GAMSTEP 0.080203 0.078636 0.07418575
## FDA 0.087100 0.067898 0.07359250
## GLM 0.080344 0.073155 0.07337325
## MAXLIKE 0.075034 0.077120 0.07192250
## MAXNET 0.082928 0.069929 0.07111375
## EARTH 0.078518 0.071930 0.06986325
## NNET 0.066326 0.065458 0.06844000
## SVME 0.058516 0.063457 0.06197225
## SVM 0.000000 0.066722 0.03073775
## RPART 0.068517 0.000000 0.03148325
## RF 0.000000 0.060347 0.04374675
## DOMAIN 0.000000 0.000000 0.03094550
## MAHAL 0.000000 0.000000 0.00000000
## BIOCLIM 0.000000 0.000000 0.00000000
## MAXENT 0.000000 0.000000 0.00000000
## GBM 0.000000 0.000000 0.00000000
## GBMSTEP 0.000000 0.000000 0.00000000
## CF 0.000000 0.000000 0.00000000
## MGCVFIX 0.000000 0.000000 0.00000000
## BIOCLIM.O 0.000000 0.000000 0.00000000
## MAHAL01 0.000000 0.000000 0.00000000
##
## input weights for ensemble modelling based on MEAN column
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF
## 0.00000000 0.07111375 0.07192250 0.00000000 0.00000000 0.04374675 0.00000000
## GLM GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH
## 0.07337325 0.07478725 0.07428050 0.07418575 0.07525575 0.00000000 0.06986325
## RPART NNET FDA SVM SVME GLMNET BIOCLIM.O
## 0.03148325 0.06844000 0.07359250 0.03073775 0.06197225 0.07430025 0.00000000
## BIOCLIM DOMAIN MAHAL MAHAL01
## 0.00000000 0.03094550 0.00000000 0.00000000
##
## Minimum input weight is 0.05
##
## final suggested weights for ensemble forecasting
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.082395 0.083331 0.000000 0.000000 0.000000 0.000000 0.085013
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.086651 0.086063 0.085955 0.087194 0.000000 0.080946 0.000000 0.079297
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.085266 0.000000 0.071803 0.086086 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
##
## Results with final weights for ensemble.evaluate for k = 1
##
## Calculated fixed threshold of 0.51516632 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6749821 0.2788530 0.8773431 0.1905376 0.2751493 0.5161290 0.3203125
## AUCdiff Tjur
## 0.1063864 0.1101746
##
## Results with final weights for ensemble.evaluate for k = 2
##
## Calculated fixed threshold of 0.52952487 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6610128 0.4001967 0.9042047 0.1627335 0.2787731 0.7222222 0.1598361
## AUCdiff Tjur
## 0.1175893 0.1137271
##
## Results with final weights for ensemble.evaluate for k = 3
##
## Calculated fixed threshold of 0.48732605 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed
## 0.80273438 0.61607143 0.83680511 0.38392857 0.52563512 0.25000000
## MCR.fixed AUCdiff Tjur
## 0.35833333 -0.08002128 0.20224674
##
## Results with final weights for ensemble.evaluate for k = 4
##
## Calculated fixed threshold of 0.47800923 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.69226667 0.39111111 0.81238065 0.16000000 0.22865860 0.40000000 0.43600000
## AUCdiff Tjur
## 0.06850826 0.10522027
##
## AUC for ensemble models based on suggested input weights (using presence and background data sets generated for 4-fold cross-validations)
## T_1 T_2 T_3 T_4 MEAN.T
## 0.6749821 0.6610128 0.8027344 0.6922667 0.7077490
##
## (Results with input weights inferred from MEAN.T column with similar procedures
## parameters for weighting of MEAN.T: ENSEMBLE.min=0.55, ENSEMBLE.best=0 and ENSEMBLE.exponent=1
##
## Final suggested weights with this alternative procedure
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.068728 0.069338 0.000000 0.000000 0.055356 0.000000 0.070796
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.072065 0.071618 0.071520 0.072559 0.000000 0.067299 0.055501 0.066011
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.071094 0.056843 0.059632 0.071639 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
##
## Results with alternative final weights for ensemble.evaluate for k = 1
##
## Calculated fixed threshold of 0.50565447 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.6769892 0.2877419 0.8773431 0.1992832 0.3121530 0.6451613 0.2148438
## AUCdiff Tjur
## 0.2251828 0.1109183
##
## Results with alternative final weights for ensemble.evaluate for k = 2
##
## Calculated fixed threshold of 0.47265919 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.64773845 0.37807276 0.90420474 0.05899705 0.08966380 0.66666667 0.30327869
## AUCdiff Tjur
## 0.25586360 0.09378001
##
## Results with alternative final weights for ensemble.evaluate for k = 3
##
## Calculated fixed threshold of 0.50883539 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.7993862 0.5848214 0.8029967 0.5223214 0.6844481 0.3125000 0.1750000
## AUCdiff Tjur
## 0.1044800 0.1963830
##
## Results with alternative final weights for ensemble.evaluate for k = 4
##
## Calculated fixed threshold of 0.49520428 corresponding to highest sum of sensitivity and specificity
## AUC TSS SEDI TSS.fixed SEDI.fixed FNR.fixed MCR.fixed
## 0.67448889 0.35111111 0.79914163 0.30666667 0.44498247 0.52000000 0.20800000
## AUCdiff Tjur
## 0.22205812 0.09893864
##
## AUC for ensemble models based on alternative input weights
## T_1 T_2 T_3 T_4 MEAN.T
## 0.6769892 0.6477384 0.7993862 0.6744889 0.6996507
## )
# step 1 generated the weights for each algorithm
model.weights <- ensemble.calibrate.step1$output.weights
model.weights
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.082395 0.083331 0.000000 0.000000 0.000000 0.000000 0.085013
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.086651 0.086063 0.085955 0.087194 0.000000 0.080946 0.000000 0.079297
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.085266 0.000000 0.071803 0.086086 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
x.batch <- ensemble.calibrate.step1$x
p.batch <- ensemble.calibrate.step1$p
a.batch <- ensemble.calibrate.step1$a
# step 2: calibrate models with all available presence locations
# weights determined in step 1 calculate ensemble in step 2
ensemble.calibrate.step2 <- ensemble.calibrate.models(
x=x.batch, p=p.batch, a=a.batch,
SINK=FALSE, species.name="Bradypus",
models.keep=TRUE,
input.weights=model.weights,
ENSEMBLE.tune=FALSE, PROBIT=TRUE,
Yweights="BIOMOD",
PLOTS=FALSE, formulae.defaults=TRUE)
##
## NOTE: raster procedures will be done via the raster package, not terra
## This also allows usage of dismo::prepareData internally.
##
##
##
## Summary of Training data set used for calibrations (rows: 990)
## pb bio5 bio6 bio16
## Min. :0.00000 Min. :100.0 Min. :-98.0 Min. : 4.0
## 1st Qu.:0.00000 1st Qu.:306.0 1st Qu.:151.0 1st Qu.: 653.0
## Median :0.00000 Median :321.0 Median :192.0 Median : 850.5
## Mean :0.09091 Mean :309.6 Mean :171.2 Mean : 826.8
## 3rd Qu.:0.00000 3rd Qu.:330.0 3rd Qu.:209.0 3rd Qu.: 978.0
## Max. :1.00000 Max. :362.0 Max. :236.0 Max. :2458.0
## bio17
## Min. : 0.0
## 1st Qu.: 75.0
## Median : 159.5
## Mean : 211.5
## 3rd Qu.: 285.0
## Max. :1496.0
##
## 'data.frame': 990 obs. of 5 variables:
## $ pb : num 1 1 1 1 1 1 1 1 1 1 ...
## $ bio5 : num 329 306 327 312 326 246 299 337 335 325 ...
## $ bio6 : num 150 220 220 218 154 131 195 199 231 185 ...
## $ bio16: num 1547 739 807 2426 1081 ...
## $ bio17: num 373 222 281 1496 280 ...
##
## (no tests with separate data set)
## Warning in dismo::randomPoints(x[[1]], n = MAXENT.an, p = p, excludep = T):
## generated random points = 0.9685 times requested number
##
## Summary of Training data set used for calibration of MAXENT or MAXLIKE model (rows: 9775, presence locations: 90)
## bio5 bio6 bio16 bio17
## Min. : 61.0 Min. :-212.00 Min. : 0.0 Min. : 0.0
## 1st Qu.:298.0 1st Qu.: 10.00 1st Qu.: 282.0 1st Qu.: 30.0
## Median :320.0 Median : 113.00 Median : 485.0 Median : 84.0
## Mean :305.4 Mean : 93.78 Mean : 543.5 Mean : 138.4
## 3rd Qu.:334.0 3rd Qu.: 183.00 3rd Qu.: 810.0 3rd Qu.: 213.0
## Max. :422.0 Max. : 242.00 Max. :2458.0 Max. :1496.0
##
## 1. Maximum entropy algorithm (package: maxnet)
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 1152.42546159814
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7454321
## cor : 0.2715249
## max TPR+TNR at : 0.6083998
##
## Threshold (method: spec_sens)
## [1] 0.6083998
##
## 2. Maxlike algorithm (package: maxlike)
##
## Evaluation with calibration data of other algorithms
##
## (Predictions transformed with probit link)
## Residual deviance (dismo package): 1270.23368476679
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7131111
## cor : 0.2546577
## max TPR+TNR at : 0.5345953
##
## Threshold (method: spec_sens)
## [1] 0.5345953
##
## 3. Generalized Linear Model
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1161.05530192348
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.745679
## cor : 0.2630394
## max TPR+TNR at : 0.5593525
##
## Threshold (method: spec_sens)
## [1] 0.5593525
##
## 4. Stepwise Generalized Linear Model
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##
## stepwise GLM formula
##
## pb ~ bio5 + bio6 + I(bio6^2) + I(bio16^3)
## <environment: 0x000002f22abe5480>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1178.71973984438
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.738037
## cor : 0.2495722
## max TPR+TNR at : 0.5645701
##
## Threshold (method: spec_sens)
## [1] 0.5645701
##
## 5. Generalized Additive Model (package: gam)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1215.28422927513
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.719
## cor : 0.2222923
## max TPR+TNR at : 0.6396201
##
## Threshold (method: spec_sens)
## [1] 0.6396201
##
## 6. Stepwise Generalized Additive Model (package: gam)
##
## stepwise GAM formula (gam package)
##
## pb ~ bio5 + bio6 + bio16 + bio17
## <environment: 0x000002f22abe5480>
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1215.28422927513
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.719
## cor : 0.2222923
## max TPR+TNR at : 0.6396201
##
## Threshold (method: spec_sens)
## [1] 0.6396201
##
## 7. Generalized Additive Model (package: mgcv)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1170.03872466445
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7405185
## cor : 0.2568954
## max TPR+TNR at : 0.6110988
##
## Threshold (method: spec_sens)
## [1] 0.6110988
##
## 8. Multivariate Adaptive Regression Splines (package: earth)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1156.79901109741
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7918519
## cor : 0.3455637
## max TPR+TNR at : 0.4073669
##
## Threshold (method: spec_sens)
## [1] 0.4073669
##
## 9. Artificial Neural Network (package: nnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1164.99441154539
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7318889
## cor : 0.2561176
## max TPR+TNR at : 0.5019502
##
## Threshold (method: spec_sens)
## [1] 0.5019502
##
## 10. Flexible Discriminant Analysis (package: mda)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1263.68974872914
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7463457
## cor : 0.2967188
## max TPR+TNR at : 0.4600055
##
## Threshold (method: spec_sens)
## [1] 0.4600055
##
## 11. Support Vector Machines (package: e1071)
##
## Evaluation with calibration data
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1310.10258973308
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.6212346
## cor : 0.1397986
## max TPR+TNR at : 0.5118686
##
## Threshold (method: spec_sens)
## [1] 0.5118686
##
## 12. GLM with lasso or elasticnet regularization (package: glmnet)
##
## Evaluation with calibration data
## (Predictions transformed with probit link)
##
## Residual deviance (dismo package): 1215.0943349405
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7195556
## cor : 0.2220033
## max TPR+TNR at : 0.4906191
##
## Threshold (method: spec_sens)
## [1] 0.4906191
##
## Ensemble weights based directly on input weights scaled to sum up to 1
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.082395 0.083331 0.000000 0.000000 0.000000 0.000000 0.085013
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.086651 0.086063 0.085955 0.087194 0.000000 0.080946 0.000000 0.079297
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.085266 0.000000 0.071803 0.086086 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
##
##
## 13. Ensemble algorithm
##
## Ensemble evaluation with calibration data
##
## Residual deviance (dismo package): 1160.83649520658
## Residual deviance if all predictions were 0.0909090909090909 (prevalence): 603.179472751492
## Residual deviance for worst possible predictions: 41032.0664080614
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7512469
## cor : 0.2806821
## max TPR+TNR at : 0.5490807
##
## Threshold (method: spec_sens)
## [1] 0.5490807
##
##
##
## finished model calibrations (function ensemble.calibrate.models)
time1 <- Sys.time()
ensemble.terra.results <- ensemble.terra(xn=predictors.terra,
models.list=ensemble.calibrate.step2$models,
input.weights=model.weights,
SINK=FALSE, evaluate=TRUE,
RASTER.species.name="Bradypus_terra", RASTER.stack.name="base")
##
## Start of predictions for organism: Bradypus_terra
## Predictions for SpatRaster: base
## ensemble raster layers will be saved in folder E:/Roeland/R/BiodiversityR/terra//ensembles
##
##
## 1. Maximum entropy algorithm (package: maxnet)
## Probit transformation
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7454321
## cor : 0.2715035
## max TPR+TNR at : 0.6079
##
## Threshold (method: spec_sens)
## [1] 0.6079
##
## 2. Maxlike algorithm (package: maxlike)
## Probit transformation
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7130864
## cor : 0.2546636
## max TPR+TNR at : 0.5339
##
## Threshold (method: spec_sens)
## [1] 0.5339
##
## 3. Generalized Linear Model
## Probit transformation
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7456852
## cor : 0.2630449
## max TPR+TNR at : 0.5589
##
## Threshold (method: spec_sens)
## [1] 0.5589
##
## 4. Stepwise Generalized Linear Model
## Probit transformation
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7380864
## cor : 0.2496305
## max TPR+TNR at : 0.5639
##
## Threshold (method: spec_sens)
## [1] 0.5639
##
## 5. Generalized Additive Model (package: gam)
## Probit transformation
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7190802
## cor : 0.2223187
## max TPR+TNR at : 0.6389
##
## Threshold (method: spec_sens)
## [1] 0.6389
##
## 6. Stepwise Generalized Additive Model (package: gam)
## Probit transformation
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7190802
## cor : 0.2223187
## max TPR+TNR at : 0.6389
##
## Threshold (method: spec_sens)
## [1] 0.6389
##
## 7. Generalized Additive Model (package: mgcv)
## [1] "GAM (package: mgcv) prediction failed"
##
## WARNING: GAM prediction (mgcv package) failed
##
##
## 8. Multivariate Adaptive Regression Splines (package: earth)
## [1] "MARS (package: earth) prediction failed"
##
## WARNING: MARS prediction (earth package) failed
##
##
## 9. Artificial Neural Network (package: nnet)
## [1] "Artificial Neural Network (package: nnet) prediction failed"
##
## WARNING: ANN prediction (nnet package) failed
##
##
## 10. Flexible Discriminant Analysis (package: mda)
## Probit transformation
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7460741
## cor : 0.2967351
## max TPR+TNR at : 0.4599
##
## Threshold (method: spec_sens)
## [1] 0.4599
##
## 11. Support Vector Machines (package: e1071)
## [1] "SVM prediction (e1071 package) failed"
##
## WARNING: SVM prediction (e1071 package) failed
##
##
## 12. GLM with lasso or elasticnet regularization (package: glmnet)
## Probit transformation
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7195185
## cor : 0.2219521
## max TPR+TNR at : 0.4899
##
## Threshold (method: spec_sens)
## [1] 0.4899
##
## WARNING: some predictions failed
## actual weights that were used were (-1 indicates failed predictions):
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.000000 0.082395 0.083331 0.000000 0.000000 0.000000 0.000000 0.085013
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.086651 0.086063 0.085955 -1.000000 0.000000 -1.000000 0.000000 -1.000000
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.085266 0.000000 -1.000000 0.086086 0.000000 0.000000 0.000000 0.000000
## MAHAL01
## 0.000000
##
## Because ensemble suitability would therefore underestimated
## the ensemble will not be calibrated
time2 <- Sys.time()
time.terra <- time2 - time1
time.terra
## Time difference of 10.77487 secs
time1 <- Sys.time()
ensemble.raster.results <- ensemble.raster(xn=predictors.raster,
models.list=ensemble.calibrate.step2$models,
input.weights=model.weights,
SINK=FALSE, evaluate=TRUE,
RASTER.format="GTiff",
RASTER.species.name="Bradypus_raster", RASTER.stack.name="base")
##
## Start of predictions for organism: Bradypus_raster
## Predictions for RasterStack: base
## ensemble raster layers will be saved in folder E:/Roeland/R/BiodiversityR/terra//ensembles
##
##
## 1. Maximum entropy algorithm (package: maxnet)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7454321
## cor : 0.2715035
## max TPR+TNR at : 0.6079
##
## Threshold (method: spec_sens)
## [1] 0.6079
##
## 2. Maxlike algorithm (package: maxlike)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7130864
## cor : 0.2546636
## max TPR+TNR at : 0.5339
##
## Threshold (method: spec_sens)
## [1] 0.5339
##
## 3. Generalized Linear Model
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7456852
## cor : 0.2630449
## max TPR+TNR at : 0.5589
##
## Threshold (method: spec_sens)
## [1] 0.5589
##
## 4. Stepwise Generalized Linear Model
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7380864
## cor : 0.2496305
## max TPR+TNR at : 0.5639
##
## Threshold (method: spec_sens)
## [1] 0.5639
##
## 5. Generalized Additive Model (package: gam)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7190802
## cor : 0.2223187
## max TPR+TNR at : 0.6389
##
## Threshold (method: spec_sens)
## [1] 0.6389
##
## 6. Stepwise Generalized Additive Model (package: gam)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7190802
## cor : 0.2223187
## max TPR+TNR at : 0.6389
##
## Threshold (method: spec_sens)
## [1] 0.6389
##
## 7. Generalized Additive Model (package: mgcv)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7406111
## cor : 0.2569669
## max TPR+TNR at : 0.6109
##
## Threshold (method: spec_sens)
## [1] 0.6109
##
## 8. Multivariate Adaptive Regression Splines (package: earth)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7918025
## cor : 0.3455432
## max TPR+TNR at : 0.4069
##
## Threshold (method: spec_sens)
## [1] 0.4069
##
## 9. Artificial Neural Network (package: nnet)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7309259
## cor : 0.2561497
## max TPR+TNR at : 0.5019
##
## Threshold (method: spec_sens)
## [1] 0.5019
##
## 10. Flexible Discriminant Analysis (package: mda)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7460741
## cor : 0.2967351
## max TPR+TNR at : 0.4599
##
## Threshold (method: spec_sens)
## [1] 0.4599
##
## 11. Support Vector Machines (package: e1071)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.6224815
## cor : 0.1399405
## max TPR+TNR at : 0.5119
##
## Threshold (method: spec_sens)
## [1] 0.5119
##
## 12. GLM with lasso or elasticnet regularization (package: glmnet)
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
## Probit transformation
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
|
| | 0%
|
|================== | 25%
|
|=================================== | 50%
|
|==================================================== | 75%
|
|======================================================================| 100%
##
##
## Evaluation at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.7195185
## cor : 0.2219521
## max TPR+TNR at : 0.4899
##
## Threshold (method: spec_sens)
## [1] 0.4899
##
## submodel thresholds for absence-presence used:
## (thresholds recalculated from raster layers)
## MAXENT MAXNET MAXLIKE GBM GBMSTEP RF CF GLM
## 0.0000000 0.6079000 0.5339000 0.0000000 0.0000000 0.0000000 0.0000000 0.5589000
## GLMSTEP GAM GAMSTEP MGCV MGCVFIX EARTH RPART NNET
## 0.5639000 0.6389000 0.6389000 0.6109000 0.0000000 0.4069000 0.0000000 0.5019000
## FDA SVM SVME GLMNET BIOCLIM.O BIOCLIM DOMAIN MAHAL
## 0.4599000 0.0000000 0.5119000 0.4899000 0.0000000 0.0000000 0.0000000 0.0000000
## MAHAL01 ENSEMBLE
## 0.0000000 0.5490807
##
##
## 13. Ensemble algorithm
##
## Evaluation of created ensemble raster layer (ensembles//suitability//Bradypus_raster_base) at locations p and a
##
## class : ModelEvaluation
## n presences : 90
## n absences : 900
## AUC : 0.751179
## cor : 0.2806828
## max TPR+TNR at : 0.5479
##
## Threshold (method: spec_sens)
## [1] 0.5479
##
## End of modelling for organism: Bradypus_raster
##
## Predictions were made for RasterStack: base
time2 <- Sys.time()
time.raster <- time2 - time1
time.raster
## Time difference of 52.82183 secs
time.terra - time.raster
## Time difference of -42.04696 secs
as.numeric(time.terra) / as.numeric(time.raster)
## [1] 0.2039851
In the ‘suitability’ folder, a suitability map with the weighted average suitability from the different algorithms is available.
suit.file <- paste0(getwd(), "//ensembles//suitability//Bradypus_terra_base.tif")
suit.raster <- terra::rast(suit.file)/1000
plot(suit.raster)
Areas above the absence-presence threshold can be highlighted with the following procedure. At the same time, areas below the threshold with a sensitivity (true positive rate) above 0.90 are shown.
pres.file <- paste0(getwd(), "//ensembles//presence//Bradypus_terra_base.tif")
pres.raster <- terra::rast(pres.file)
plot(pres.raster)
suit.raster.masked <- terra::mask(suit.raster,
mask=pres.raster,
maskvalue=0,
updatevalue=NA) # calculate quantiles first
breaks1 <- quantile(as.data.frame(suit.raster.masked,
xy=FALSE, na.rm=TRUE)[, 1])
p_values <- terra::extract(suit.raster, y=pres.env)[, 2]
a_values <- terra::extract(suit.raster, y=background3)[, 2]
breaks2 <- dismo::threshold(dismo::evaluate(p=p_values, a=a_values),
stat="sensitivity",
sensitivity=0.90)
breaks1 <- c(0.0, breaks2, breaks1)
suit.classified <- terra::classify(suit.raster,
rcl=as.matrix(breaks1),
include.lowest=TRUE)
plot.colours <- RColorBrewer::brewer.pal(length(breaks1), "Greens")
plot.colours[1] <- "grey60"
plot.colours[2] <- "#D8B365"
plot(suit.classified, col=plot.colours)
suit.zoomed <- terra::crop(suit.classified,
y=c(bbox_study2["left"], bbox_study2["right"],
bbox_study2["bottom"], bbox_study2["top"]))
plot(suit.zoomed, col=plot.colours)
Country boundarie were previously added that were downloaded as 1:10 million Admin 0 vector data from Natural Earth.
To map via ggplot2, using geom_contour_filled is an appropriate method to match the projection system.
suit.data <- as.data.frame(suit.raster,
xy=TRUE,
na.rm=TRUE)
names(suit.data)[3] <- "suitability"
map_study <- ggplot() +
geom_contour_filled(data=suit.data,
aes(x=x, y=y, z=suitability),
alpha=0.8, colour=NA, breaks=breaks1, show.legend=TRUE) +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
# geom_sf(data=countries.poly,
# colour=alpha("grey50", alpha=0.5), fill=NA, size=0.4, alpha=0.3) +
annotation_north_arrow(location="tr",
height=unit(1, "cm"),
width=unit(1, "cm")) +
scale_fill_manual(values=plot.colours) +
labs(fill="suitability") +
theme(axis.title = element_blank(),
panel.background = element_rect(fill="light steel blue"),
legend.position=c(0.9, 0.8)) +
coord_sf(xlim=c(bbox_study["left"], bbox_study["right"]),
ylim=c(bbox_study["bottom"], bbox_study["top"]),
crs=4326, expand=FALSE)
## Warning: A numeric `legend.position` argument in `theme()` was deprecated in ggplot2
## 3.5.0.
## ℹ Please use the `legend.position.inside` argument of `theme()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
map_study
## Warning: Using the `size` aesthetic in this geom was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` in the `default_aes` field and elsewhere instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
suit.zoomed2 <- terra::crop(suit.raster, snap="out",
y=c(bbox_study2["left"], bbox_study2["right"],
bbox_study2["bottom"], bbox_study2["top"]))
suit.data <- as.data.frame(suit.zoomed2,
xy=TRUE,
na.rm=TRUE)
names(suit.data)[3] <- "suitability"
map_study2 <- ggplot() +
geom_contour_filled(data=suit.data,
aes(x=x, y=y, z=suitability),
alpha=0.8, colour=NA, breaks=breaks1, show.legend=TRUE) +
# geom_sf(data=countries.poly,
# colour=alpha("grey50", alpha=0.5), fill=NA, size=0.4, alpha=0.3) +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
annotation_north_arrow(location="tr",
height=unit(1, "cm"),
width=unit(1, "cm")) +
scale_fill_manual(values=plot.colours) +
labs(fill="suitability") +
theme(axis.title = element_blank(),
panel.background = element_rect(fill="light steel blue"),
legend.position=c(0.9, 0.8)) +
coord_sf(xlim=c(bbox_study2["left"], bbox_study2["right"]),
ylim=c(bbox_study2["bottom"], bbox_study2["top"]),
crs=4326, expand=FALSE)
map_study2
Mendes et al. 2020 described and compared different a priori and a posteriori methods of adding distance constraints to reduce overprediction in species distribution modelling exercises. The Buffered Minimum Convex Polygon method was described as a reliable method. The convex hull of this method can be obtained via the function of BiodiversityR::ensemble.chull.create.
BMCP.hull <- BiodiversityR::ensemble.chull.create(p=pres,
buffer.maxmins=TRUE,
buffer.width=1,
poly.only=TRUE,
lonlat.dist=TRUE)
##
## Creation of convex hull around presence locations
## Buffer around convex hull of 7.83522650916998 (1 * 7.83522650916998, where 7.83522650916998 is the maximum of the distances to the closest neighbour for each presence location)
## This maximum distance corresponds to a distance in km of: 827.825363277606
hull.file <- paste0(getwd(), "//Bradypus_BMCP.shp")
# shapefile(BMCP.hull$convex.hull, filename=hull.file, overwrite=TRUE)
BMCP.poly <- sf::st_read(hull.file, crs=4326)
## Reading layer `Bradypus_BMCP' from data source
## `E:\Roeland\R\BiodiversityR\terra\Bradypus_BMCP.shp' using driver `ESRI Shapefile'
## Simple feature collection with 1 feature and 1 field
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: -93.74889 ymin: -31.28005 xmax: -32.28963 ymax: 21.72844
## Geodetic CRS: WGS 84
suit.data <- as.data.frame(suit.raster,
xy=TRUE,
na.rm=TRUE)
names(suit.data)[3] <- "suitability"
map_study <- ggplot() +
geom_contour_filled(data=suit.data,
aes(x=x, y=y, z=suitability),
alpha=0.8, colour=NA, breaks=breaks1, show.legend=TRUE) +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
# geom_sf(data=countries.poly,
# colour=alpha("grey50", alpha=0.5), fill=NA, size=0.4, alpha=0.3) +
geom_sf(data=BMCP.poly,
colour=alpha("red", alpha=0.5), fill=NA, size=1.5, alpha=0.3) +
annotation_north_arrow(location="tr",
height=unit(1, "cm"),
width=unit(1, "cm")) +
scale_fill_manual(values=plot.colours) +
labs(fill="suitability") +
theme(axis.title = element_blank(),
panel.background = element_rect(fill="light steel blue"),
legend.position=c(0.9, 0.8)) +
coord_sf(xlim=c(bbox_study["left"], bbox_study["right"]),
ylim=c(bbox_study["bottom"], bbox_study["top"]),
crs=4326, expand=FALSE)
map_study
bbox_study3 <- sf::st_bbox(BMCP.poly)
suit.zoomed3 <- terra::crop(suit.raster, snap="out",
y=c(bbox_study3["xmin"]-2, bbox_study3["xmax"]+2,
bbox_study3["ymin"]-2, bbox_study3["ymax"]+2))
suit.data <- as.data.frame(suit.zoomed3,
xy=TRUE,
na.rm=TRUE)
names(suit.data)[3] <- "suitability"
map_study2 <- ggplot() +
geom_contour_filled(data=suit.data,
aes(x=x, y=y, z=suitability),
alpha=0.8, colour=NA, breaks=breaks1, show.legend=TRUE) +
# geom_sf(data=countries.poly,
# colour=alpha("grey50", alpha=0.5), fill=NA, size=0.4, alpha=0.3) +
geom_mark_hull(data=pres,
aes(x=lon, y=lat),
colour="red") +
geom_sf(data=BMCP.poly,
colour=alpha("red", alpha=0.5), fill=NA, size=1.5, alpha=0.3) +
annotation_north_arrow(location="tr",
height=unit(1, "cm"),
width=unit(1, "cm")) +
scale_fill_manual(values=plot.colours) +
labs(fill="suitability") +
theme(axis.title = element_blank(),
panel.background = element_rect(fill="light steel blue"),
legend.position=c(0.9, 0.8)) +
coord_sf(xlim=c(bbox_study3["xmin"]-2, bbox_study3["xmax"]+2),
ylim=c(bbox_study3["ymin"]-2, bbox_study3["ymax"]+2),
crs=4326, expand=FALSE)
map_study2
sessionInfo()
## R version 4.2.1 (2022-06-23 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19045)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United Kingdom.utf8
## [2] LC_CTYPE=English_United Kingdom.utf8
## [3] LC_MONETARY=English_United Kingdom.utf8
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United Kingdom.utf8
##
## attached base packages:
## [1] tcltk stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] ggforce_0.4.0 ggspatial_1.1.6 ggmap_4.0.0
## [4] ggplot2_3.5.1 terra_1.7-46 dismo_1.3-14
## [7] rgdal_1.5-32 raster_3.6-23 sp_1.5-0
## [10] BiodiversityR_2.17-4 vegan_2.7-2 permute_0.9-7
##
## loaded via a namespace (and not attached):
## [1] readxl_1.4.1 backports_1.4.1 Hmisc_4.7-1
## [4] plyr_1.8.7 splines_4.2.1 digest_0.6.29
## [7] foreach_1.5.2 htmltools_0.5.6 earth_5.3.1
## [10] fansi_1.0.3 relimp_1.0-5 magrittr_2.0.3
## [13] checkmate_2.1.0 cluster_2.1.3 tcltk2_1.2-11
## [16] sandwich_3.0-2 jpeg_0.1-9 colorspace_2.0-3
## [19] mitools_2.4 haven_2.5.1 xfun_0.33
## [22] dplyr_1.1.2 crayon_1.5.1 jsonlite_1.8.0
## [25] maxlike_0.1-10 lme4_1.1-30 survival_3.3-1
## [28] zoo_1.8-11 iterators_1.0.14 glue_1.6.2
## [31] polyclip_1.10-0 gtable_0.3.6 V8_4.2.2
## [34] kernlab_0.9-31 car_3.1-0 shape_1.4.6
## [37] abind_1.4-5 scales_1.4.0 DBI_1.1.3
## [40] Rcpp_1.0.12 plotrix_3.8-2 isoband_0.2.5
## [43] viridisLite_0.4.1 htmlTable_2.4.1 units_0.8-0
## [46] foreign_0.8-82 proxy_0.4-27 Formula_1.2-4
## [49] survey_4.1-1 glmnet_4.1-6 htmlwidgets_1.5.4
## [52] httr_1.4.4 RColorBrewer_1.1-3 geosphere_1.5-14
## [55] wk_0.6.0 ellipsis_0.3.2 pkgconfig_2.0.3
## [58] farver_2.1.1 nnet_7.3-17 sass_0.4.2
## [61] deldir_1.0-6 utf8_1.2.2 tidyselect_1.2.0
## [64] labeling_0.4.2 rlang_1.1.1 TeachingDemos_2.12
## [67] cellranger_1.1.0 tools_4.2.1 cachem_1.0.6
## [70] cli_3.4.1 generics_0.1.3 evaluate_0.16
## [73] stringr_1.4.1 fastmap_1.1.1 yaml_2.3.5
## [76] maxnet_0.1.4 knitr_1.40 randomForest_4.7-1.1
## [79] purrr_0.3.4 blockCV_3.1-3 s2_1.1.0
## [82] nlme_3.1-157 gam_1.22 concaveman_1.1.0
## [85] compiler_4.2.1 rstudioapi_0.14 curl_5.0.2
## [88] png_0.1-7 e1071_1.7-11 tibble_3.2.1
## [91] tweenr_2.0.3 bslib_0.4.0 stringi_1.7.8
## [94] plotmo_3.6.2 highr_0.9 forcats_0.5.2
## [97] lattice_0.20-45 Matrix_1.5-1 classInt_0.4-8
## [100] nloptr_2.0.3 gbm_2.1.8.1 vctrs_0.6.3
## [103] effects_4.2-2 RcmdrMisc_2.9-1 pillar_1.9.0
## [106] lifecycle_1.0.3 jquerylib_0.1.4 data.table_1.14.2
## [109] bitops_1.0-7 insight_0.18.4 R6_2.5.1
## [112] latticeExtra_0.6-30 KernSmooth_2.23-20 gridExtra_2.3
## [115] codetools_0.2-18 boot_1.3-28 MASS_7.3-57
## [118] withr_2.5.0 nortest_1.0-4 Rcmdr_2.9-5
## [121] mgcv_1.8-40 parallel_4.2.1 hms_1.1.2
## [124] grid_4.2.1 rpart_4.1.16 tidyr_1.2.1
## [127] class_7.3-20 minqa_1.2.4 rmarkdown_2.16
## [130] carData_3.0-5 mda_0.5-3 sf_1.0-16
## [133] base64enc_0.1-3 interp_1.1-3