This is the documentation around the Biomod2 package for the ‘Spatial Modeling and Prediction’ class of the University of Würzburg. It follows the chapter 19 of the book Habitat Suitability and Distribution Models from Antoine Guisan, Wilfried Thuiller and Niklaus E. Zimmermann.
Large aggressive hummingbird that usually dominates feeders or flower patches. Sparkling green overall with purplish-blue patches on cheeks and belly. Common and widespread in the Andes. Found from 400-4500 m; most common from the subtropical zone up to high elevation scrub and dry valleys, but also wanders low into foothills. Took from Ebird
BIOMOD is a computer platform for ensemble forecasting of species distributions, enabling the treatment of a range of methodological uncertainties in models and the examination of species-environment relationships.
#---Github version---#
# library(devtools)
# devtools::install_github("biomodhub/biomod2", dependencies = TRUE)
#---CRAN version---#
#install.packages("biomod2")
#---Callling Libraries---#
library(ade4)
library(biomod2)
library(dismo)
library(dplyr)
library(ggplot2)
library(raster)
library(rasterVis)
library(rgdal)
library(rgeos)
library(rnaturalearth)
library(sf)
library(stringr)
library(terra)
library(tidyverse)
south_america <- ne_countries(continent = "South America", returnclass = "sf")
colibri <- gbif("Colibri", "coruscans",
ext = extent(south_america),
sp = TRUE, removeZeros = TRUE,
start = 0,
end = 500)
colibri_df <- as.data.frame(colibri)
proj4string(colibri) <- CRS("+proj=longlat +datum=WGS84")
The data we are going to use corresponds to the current time, for the year 2050 and 2070, in order to see the possible changes through the time.
clim = getData('worldclim', var='bio', res=10)
bio_50= getData('CMIP5', var='bio', res=10, rcp=85, model='BC', year=50)
bio_70= getData('CMIP5', var='bio', res=10, rcp=85, model='BC', year=70)
names(bio_50)<-c("bio1", "bio2", "bio3", "bio4", "bio5","bio6", "bio7",
"bio8", "bio9", "bio10", "bio11", "bio12", "bio13",
"bio14", "bio15", "bio16", "bio17", "bio18", "bio19")
names(bio_70)<-c("bio1", "bio2", "bio3", "bio4", "bio5","bio6", "bio7",
"bio8", "bio9", "bio10", "bio11", "bio12", "bio13",
"bio14", "bio15", "bio16", "bio17", "bio18", "bio19")
Cropping the data
sa_50<-raster::crop(bio_50,south_america)
sa_70<-raster::crop(bio_70,south_america)
plot(sa_50)
plot(sa_70)
colibri_cell_id<- cellFromXY(subset(sa_50,1), colibri)
sa_50_df<-na.omit(as.data.frame(sa_50))
head(sa_50_df)
## bio1 bio2 bio3 bio4 bio5 bio6 bio7 bio8 bio9 bio10 bio11 bio12 bio13 bio14
## 57 302 83 73 934 358 246 112 305 290 313 290 227 70 0
## 58 301 82 74 942 356 246 110 305 289 312 289 234 72 0
## 59 299 81 74 944 354 245 109 304 287 311 287 245 74 0
## 60 296 81 75 947 349 241 107 300 283 307 283 274 78 1
## 61 291 80 73 971 345 236 109 297 278 303 278 301 83 3
## 68 290 63 67 950 338 245 93 299 286 301 277 347 58 12
## bio15 bio16 bio17 bio18 bio19
## 57 102 145 6 38 7
## 58 96 141 10 38 10
## 59 92 141 12 40 12
## 60 85 153 16 50 16
## 61 82 168 22 60 22
## 68 50 152 42 114 64
pca_sa<- dudi.pca(sa_50_df,scannf = F,nf=2)
#PCA score
plot(pca_sa$li)
#tail of distributions
sort(pca_sa$li[,1])[1:10]
## [1] -9.221379 -8.956356 -8.842250 -8.732418 -8.725608 -8.536325 -8.475859
## [8] -8.473945 -8.472590 -8.425057
#IDs of points to remove
(to_remove <- which(pca_sa$li[, 1] < -10))
## integer(0)
#remove points and re-computer
if (length(to_remove)) {
sa_50_df <- sa_50_df[-to_remove, ]
pca_sa <- dudi.pca(sa_50_df, scannf = FALSE, nf = 2)
}
par(mfrow=c(1,2))
s.class(pca_sa$li[, 1:2], fac = factor(rownames(sa_50_df)
%in%colibri_cell_id, levels = c("FALSE","TRUE"),
labels = c("background", "Colibri")), col = c("red","blue"),
csta=0, cellipse=2,
cpoint= .3, pch=16)
mtext("(a)",side=3, line = 3, adj=0)
s.corcircle(pca_sa$co, clabel = .5)
mtext("(b)",side=3, line = 3, adj=0)
bioclim_sa_50_sub<-stack(subset(sa_50, c("bio5", "bio7","bio11","bio19")))
colibri_data<-BIOMOD_FormatingData(resp.var = rep(1, nrow(colibri_df)), expl.var = bioclim_sa_50_sub,
resp.xy= colibri_df[, c("lon","lat")],
resp.name="Colibri coruscans", PA.nb.rep = 3,
PA.nb.absences = 500, PA.strategy ="random")
##
## -=-=-=-=-=-=-=-=-=-=-=-= Colibri coruscans Data Formating -=-=-=-=-=-=-=-=-=-=-=-=
##
## ! Response variable name was converted into Colibri.coruscans
## ! No data has been set aside for modeling evaluation
## ! No data has been set aside for modeling evaluation
## !!! Some data are located in the same raster cell.
## Please set `filter.raster = TRUE` if you want an automatic filtering.
##
## Checking Pseudo-absence selection arguments...
##
## ! No data has been set aside for modeling evaluation
## > random pseudo absences selection
## > Pseudo absences are selected in explanatory variables
##
## ! No data has been set aside for modeling evaluation
## !!! Some data are located in the same raster cell.
## Please set `filter.raster = TRUE` if you want an automatic filtering.
## ! No data has been set aside for modeling evaluation
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Plot of selected pseudo-absences
plot(colibri_data)
## $data.vect
## class : SpatVector
## geometry : points
## dimensions : 3500, 2 (geometries, attributes)
## extent : -80.41667, -35.41667, -55.41667, 11.41667 (xmin, xmax, ymin, ymax)
## coord. ref. :
## names : resp dataset
## type : <num> <chr>
## values : 10 Initial dataset
## 10 Initial dataset
## 10 Initial dataset
##
## $data.label
## 9 10
## "**Presences**" "Presences (calibration)"
## 11 12
## "Presences (validation)" "Presences (evaluation)"
## 19 20
## "**True Absences**" "True Absences (calibration)"
## 21 22
## "True Absences (validation)" "True Absences (evaluation)"
## 29 30
## "**Pseudo-Absences**" "Pseudo-Absences (calibration)"
## 31 1
## "Pseudo-Absences (validation)" "Background"
##
## $data.plot
colibri_opt<-BIOMOD_ModelingOptions(GLM=list(type="quadratic", interaction.level=1),
GBM=list(n.trees=1000), GAM=list(algo="GAM_mgcv"))
colibri_models <- BIOMOD_Modeling(
bm.format = colibri_data, models = c("GLM", "GBM", "GAM", "RF"),
bm.options = colibri_opt, nb.rep = 4, data.split.perc = 80,
var.import = 3, do.full.models = FALSE, modeling.id = "ex2"
)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Build Single Models -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
##
## Checking Models arguments...
##
## > Automatic weights creation to rise a 0.5 prevalence
## ! ignored obsolete argument 'do.full.models' as 'CV.do.full.models' was also given
## !!! argument 'do.full.models' is obsolete, please use 'CV.perc' instead.
##
## /! 'CV.perc' is on a scale 0-1 and was set to data.split.perc/100 = 0.8
## ! ignored obsolete argument 'nb.rep' as 'CV.nb.rep' was also given
## Creating suitable Workdir...
##
##
## Checking Cross-Validation arguments...
##
## > Random cross-validation selection
##
##
##
## -=-=-=-=-=-=-=-=-=-=-= Colibri.coruscans Modeling Summary -=-=-=-=-=-=-=-=-=-=-=
##
## 4 environmental variables ( bio5 bio7 bio11 bio19 )
## Number of evaluation repetitions : 3
## Models selected : GLM GBM GAM RF
##
## Total number of model runs: 12
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA1_RUN1_GLM
##
## Model=GLM ( quadratic with order 1 interaction level )
## Stepwise procedure using AIC criteria
## > GLM modeling...
## Automatic formula generation...
## selected formula : Colibri.coruscans ~ I(bio5^2) + bio11 + I(bio7^2) + I(bio11^2) +
## bio7
##
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA1_RUN1_GBM
##
## Model=Generalised Boosting Regression
## 1000 maximum different trees and 3 Fold Cross-Validation
## > GBM modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA1_RUN1_GAM
##
## Model=GAM
## GAM_mgcv algorithm chosen
## Automatic formula generation...
## > GAM (mgcv) modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA1_RUN1_RF
##
## Model=Breiman and Cutler's random forests for classification and regression
## > RF modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA2_RUN1_GLM
##
## Model=GLM ( quadratic with order 1 interaction level )
## Stepwise procedure using AIC criteria
## > GLM modeling...
## Automatic formula generation...
## selected formula : Colibri.coruscans ~ I(bio5^2) + bio11 + I(bio7^2) + I(bio11^2) +
## bio7 + bio11:bio7
##
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA2_RUN1_GBM
##
## Model=Generalised Boosting Regression
## 1000 maximum different trees and 3 Fold Cross-Validation
## > GBM modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA2_RUN1_GAM
##
## Model=GAM
## GAM_mgcv algorithm chosen
## Automatic formula generation...
## > GAM (mgcv) modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA2_RUN1_RF
##
## Model=Breiman and Cutler's random forests for classification and regression
## > RF modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA3_RUN1_GLM
##
## Model=GLM ( quadratic with order 1 interaction level )
## Stepwise procedure using AIC criteria
## > GLM modeling...
## Automatic formula generation...
## selected formula : Colibri.coruscans ~ I(bio5^2) + bio11 + I(bio7^2) + I(bio11^2) +
## bio7
##
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA3_RUN1_GBM
##
## Model=Generalised Boosting Regression
## 1000 maximum different trees and 3 Fold Cross-Validation
## > GBM modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA3_RUN1_GAM
##
## Model=GAM
## GAM_mgcv algorithm chosen
## Automatic formula generation...
## > GAM (mgcv) modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
##
## -=-=-=--=-=-=- Colibri.coruscans_PA3_RUN1_RF
##
## Model=Breiman and Cutler's random forests for classification and regression
## > RF modeling...
## Evaluating Model stuff...
## Evaluating Predictor Contributions...
##
|
| | 0%
|
|====== | 8%
|
|============ | 17%
|
|================== | 25%
|
|======================= | 33%
|
|============================= | 42%
|
|=================================== | 50%
|
|========================================= | 58%
|
|=============================================== | 67%
|
|==================================================== | 75%
|
|========================================================== | 83%
|
|================================================================ | 92%
|
|======================================================================| 100%
##
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bm_PlotEvalMean(colibri_models, group.by = "full.name",
metric = c("ROC", "TSS"),
main = "Evaluation Metrics",
xlim = c(0.5, 1),
ylim = c(0.975, 1))
## $tab
## name mean1 mean2 sd1 sd2 NA NA
## 1 Colibri.coruscans_PA1_RUN1_GAM 0.983 0.998 0.982 NA NA NA
## 2 Colibri.coruscans_PA1_RUN1_GBM 0.960 0.997 0.960 NA NA NA
## 3 Colibri.coruscans_PA1_RUN1_GLM 0.950 0.988 0.950 NA NA NA
## 4 Colibri.coruscans_PA1_RUN1_RF 0.998 1.000 0.998 NA NA NA
## 5 Colibri.coruscans_PA2_RUN1_GAM 0.935 0.991 0.935 NA NA NA
## 6 Colibri.coruscans_PA2_RUN1_GBM 0.948 0.998 0.948 NA NA NA
## 7 Colibri.coruscans_PA2_RUN1_GLM 0.933 0.989 0.933 NA NA NA
## 8 Colibri.coruscans_PA2_RUN1_RF 0.988 1.000 0.988 NA NA NA
## 9 Colibri.coruscans_PA3_RUN1_GAM 0.983 0.999 0.982 NA NA NA
## 10 Colibri.coruscans_PA3_RUN1_GBM 0.955 0.998 0.955 NA NA NA
## 11 Colibri.coruscans_PA3_RUN1_GLM 0.955 0.993 0.955 NA NA NA
## 12 Colibri.coruscans_PA3_RUN1_RF 0.995 1.000 0.995 NA NA NA
##
## $plot
(colibri_models_var_imp<-get_variables_importance(colibri_models))
## full.name PA run algo expl.var rand var.imp
## 1 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio5 1 1.000000
## 2 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio7 1 0.138799
## 3 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio11 1 0.349928
## 4 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio19 1 0.000000
## 5 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio5 2 1.000000
## 6 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio7 2 0.113937
## 7 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio11 2 0.303679
## 8 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio19 2 0.000000
## 9 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio5 3 1.000000
## 10 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio7 3 0.113104
## 11 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio11 3 0.331018
## 12 Colibri.coruscans_PA1_RUN1_GLM PA1 RUN1 GLM bio19 3 0.000000
## 13 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio5 1 0.844210
## 14 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio7 1 0.067279
## 15 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio11 1 0.084269
## 16 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio19 1 0.032606
## 17 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio5 2 0.843047
## 18 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio7 2 0.065772
## 19 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio11 2 0.091247
## 20 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio19 2 0.035241
## 21 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio5 3 0.798493
## 22 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio7 3 0.065017
## 23 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio11 3 0.072959
## 24 Colibri.coruscans_PA1_RUN1_GBM PA1 RUN1 GBM bio19 3 0.032830
## 25 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio5 1 0.732565
## 26 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio7 1 0.193490
## 27 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio11 1 0.557015
## 28 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio19 1 0.000143
## 29 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio5 2 0.805258
## 30 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio7 2 0.180933
## 31 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio11 2 0.547490
## 32 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio19 2 0.000086
## 33 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio5 3 0.774088
## 34 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio7 3 0.186602
## 35 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio11 3 0.585162
## 36 Colibri.coruscans_PA1_RUN1_GAM PA1 RUN1 GAM bio19 3 0.000120
## 37 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio5 1 0.523055
## 38 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio7 1 0.130673
## 39 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio11 1 0.108001
## 40 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio19 1 0.081033
## 41 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio5 2 0.495162
## 42 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio7 2 0.141698
## 43 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio11 2 0.103016
## 44 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio19 2 0.072385
## 45 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio5 3 0.575496
## 46 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio7 3 0.127451
## 47 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio11 3 0.115750
## 48 Colibri.coruscans_PA1_RUN1_RF PA1 RUN1 RF bio19 3 0.073036
## 49 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio5 1 1.000000
## 50 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio7 1 0.193158
## 51 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio11 1 0.433136
## 52 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio19 1 0.000000
## 53 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio5 2 1.000000
## 54 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio7 2 0.167468
## 55 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio11 2 0.437314
## 56 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio19 2 0.000000
## 57 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio5 3 1.000000
## 58 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio7 3 0.190259
## 59 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio11 3 0.432939
## 60 Colibri.coruscans_PA2_RUN1_GLM PA2 RUN1 GLM bio19 3 0.000000
## 61 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio5 1 0.864928
## 62 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio7 1 0.010659
## 63 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio11 1 0.106374
## 64 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio19 1 0.013467
## 65 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio5 2 0.900266
## 66 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio7 2 0.010861
## 67 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio11 2 0.104482
## 68 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio19 2 0.014211
## 69 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio5 3 0.841890
## 70 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio7 3 0.012379
## 71 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio11 3 0.111244
## 72 Colibri.coruscans_PA2_RUN1_GBM PA2 RUN1 GBM bio19 3 0.014328
## 73 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio5 1 1.000000
## 74 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio7 1 0.146474
## 75 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio11 1 0.443120
## 76 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio19 1 0.000835
## 77 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio5 2 1.000000
## 78 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio7 2 0.161884
## 79 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio11 2 0.442236
## 80 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio19 2 0.000873
## 81 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio5 3 1.000000
## 82 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio7 3 0.164626
## 83 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio11 3 0.457395
## 84 Colibri.coruscans_PA2_RUN1_GAM PA2 RUN1 GAM bio19 3 0.000846
## 85 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio5 1 0.601570
## 86 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio7 1 0.084603
## 87 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio11 1 0.096629
## 88 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio19 1 0.048730
## 89 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio5 2 0.597679
## 90 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio7 2 0.072552
## 91 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio11 2 0.108543
## 92 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio19 2 0.049104
## 93 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio5 3 0.595338
## 94 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio7 3 0.079418
## 95 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio11 3 0.109239
## 96 Colibri.coruscans_PA2_RUN1_RF PA2 RUN1 RF bio19 3 0.048779
## 97 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio5 1 1.000000
## 98 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio7 1 0.113649
## 99 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio11 1 0.329900
## 100 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio19 1 0.000000
## 101 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio5 2 1.000000
## 102 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio7 2 0.107443
## 103 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio11 2 0.348280
## 104 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio19 2 0.000000
## 105 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio5 3 1.000000
## 106 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio7 3 0.105118
## 107 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio11 3 0.325258
## 108 Colibri.coruscans_PA3_RUN1_GLM PA3 RUN1 GLM bio19 3 0.000000
## 109 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio5 1 0.875435
## 110 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio7 1 0.011151
## 111 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio11 1 0.126826
## 112 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio19 1 0.007293
## 113 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio5 2 0.933649
## 114 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio7 2 0.009508
## 115 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio11 2 0.123358
## 116 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio19 2 0.007222
## 117 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio5 3 0.943671
## 118 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio7 3 0.012283
## 119 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio11 3 0.116968
## 120 Colibri.coruscans_PA3_RUN1_GBM PA3 RUN1 GBM bio19 3 0.007090
## 121 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio5 1 0.837389
## 122 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio7 1 0.165607
## 123 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio11 1 0.426972
## 124 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio19 1 0.037103
## 125 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio5 2 0.898434
## 126 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio7 2 0.155803
## 127 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio11 2 0.441975
## 128 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio19 2 0.035679
## 129 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio5 3 0.925548
## 130 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio7 3 0.148951
## 131 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio11 3 0.419708
## 132 Colibri.coruscans_PA3_RUN1_GAM PA3 RUN1 GAM bio19 3 0.035270
## 133 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio5 1 0.607335
## 134 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio7 1 0.082235
## 135 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio11 1 0.103451
## 136 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio19 1 0.044376
## 137 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio5 2 0.602868
## 138 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio7 2 0.080023
## 139 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio11 2 0.113218
## 140 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio19 2 0.051422
## 141 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio5 3 0.580221
## 142 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio7 3 0.078487
## 143 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio11 3 0.113577
## 144 Colibri.coruscans_PA3_RUN1_RF PA3 RUN1 RF bio19 3 0.049446
bm_PlotEvalMean(colibri_models, group.by = "PA",
metric = c("ROC", "TSS"),
main = "Evaluation Metrics",
xlim = c(0.5, 1),
ylim = c(0.975, 1))
## $tab
## name mean1 mean2 sd1 sd2 NA NA
## 1 PA1 0.97275 0.99575 0.97250 0.02177728 0.005315073 0.02162560
## 2 PA2 0.95100 0.99450 0.95100 0.02554734 0.005322906 0.02554734
## 3 PA3 0.97200 0.99750 0.97175 0.02023199 0.003109126 0.02005617
##
## $plot
bm_PlotEvalMean(colibri_models, group.by = "algo",
metric = c("ROC", "TSS"),
main = "Evaluation Metrics",
xlim = c(0.5, 1),
ylim = c(0.975, 1))
## $tab
## name mean1 mean2 sd1 sd2 NA NA
## 1 GAM 0.9670000 0.9960000 0.9663333 0.027712813 0.0043588989 0.027135463
## 2 GBM 0.9543333 0.9976667 0.9543333 0.006027714 0.0005773503 0.006027714
## 3 GLM 0.9460000 0.9900000 0.9460000 0.011532563 0.0026457513 0.011532563
## 4 RF 0.9936667 1.0000000 0.9936667 0.005131601 0.0000000000 0.005131601
##
## $plot
colibri_ensemble_models <-
BIOMOD_EnsembleModeling(
bm.mod = colibri_models,
# models.chosen = 'all',
em.by = 'all',
em.algo = c('EMmean', 'EMca'),
metric.select = c("TSS"),
metric.select.thresh = c(0.8),
metric.eval = c("KAPPA", "TSS", "ROC"),
prob.mean = FALSE,
prob.cv = TRUE,
committee.averaging = FALSE,
prob.mean.weight = TRUE,
var.import = 0
)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-= Build Ensemble Models -=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## ! all models available will be included in ensemble.modeling
## ! Ensemble Models will be filtered and/or weighted using validation dataset (if possible). Please use `metric.select.dataset` for alternative options.
## > Evaluation & Weighting methods summary :
## TSS over 0.8
##
##
## > mergedData_mergedRun_mergedAlgo ensemble modeling
## ! Additional projection required for ensemble models merging several pseudo-absence dataset...
## -=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Projecting Colibri.coruscans_PA1_RUN1_GLM ...
## > Projecting Colibri.coruscans_PA1_RUN1_GBM ...
## > Projecting Colibri.coruscans_PA1_RUN1_GAM ...
## > Projecting Colibri.coruscans_PA1_RUN1_RF ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Projecting Colibri.coruscans_PA2_RUN1_GLM ...
## > Projecting Colibri.coruscans_PA2_RUN1_GBM ...
## > Projecting Colibri.coruscans_PA2_RUN1_GAM ...
## > Projecting Colibri.coruscans_PA2_RUN1_RF ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Projecting Colibri.coruscans_PA3_RUN1_GLM ...
## > Projecting Colibri.coruscans_PA3_RUN1_GBM ...
## > Projecting Colibri.coruscans_PA3_RUN1_GAM ...
## > Projecting Colibri.coruscans_PA3_RUN1_RF ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
##
## > Mean of probabilities by TSS ...
## Evaluating Model stuff...
## > Committee averaging by TSS ...
## Evaluating Model stuff...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
colibri_models_proj_current <-
BIOMOD_Projection(
bm.mod= colibri_models,
new.env = bioclim_sa_50_sub,
proj.name = "current",
metric.binary = "TSS",
output.format = ".img",
do.stack = FALSE)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Building clamping mask
##
## > Projecting Colibri.coruscans_PA1_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_RF ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_RF ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_RF ...
## Writing projection on hard drive...
##
## > Building TSS binaries / filtered
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
colibri_ensemble_models_proj_current <-
BIOMOD_EnsembleForecasting( bm.em = colibri_ensemble_models,
bm.proj = colibri_models_proj_current,
metric.binary = "TSS",
output.format = ".img",
do.stack = FALSE)
##
## -=-=-=-=-=-=-=-=-=-=-=-= Do Ensemble Models Projection -=-=-=-=-=-=-=-=-=-=-=-=
##
## Creating suitable Workdir...
##
## > Projecting Colibri.coruscans_EMmeanByTSS_mergedData_mergedRun_mergedAlgo ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_EMcaByTSS_mergedData_mergedRun_mergedAlgo ...
## Writing projection on hard drive...
##
## > Building TSS binaries / filtered
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bioclim_sa_50_st<-subset(sa_50, c("bio5", "bio7", "bio11", "bio19"))
colibri_models_proj_2050<- BIOMOD_Projection(
bm.mod= colibri_models,
new.env = bioclim_sa_50_sub,
proj.name = "future_2050",
metric.binary = "TSS",
output.format = ".img",
do.stack = FALSE)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Building clamping mask
##
## > Projecting Colibri.coruscans_PA1_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_RF ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_RF ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_RF ...
## Writing projection on hard drive...
##
## > Building TSS binaries / filtered
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
colibri_ensemble_models_proj_2050<-BIOMOD_EnsembleForecasting(
bm.em = colibri_ensemble_models,
bm.proj = colibri_models_proj_2050,
metric.binary = "TSS",
output.format = ".img",
do.stack = FALSE)
##
## -=-=-=-=-=-=-=-=-=-=-=-= Do Ensemble Models Projection -=-=-=-=-=-=-=-=-=-=-=-=
##
## Creating suitable Workdir...
##
## > Projecting Colibri.coruscans_EMmeanByTSS_mergedData_mergedRun_mergedAlgo ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_EMcaByTSS_mergedData_mergedRun_mergedAlgo ...
## Writing projection on hard drive...
##
## > Building TSS binaries / filtered
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bioclim_sa_70_st<-subset(sa_70, c("bio5", "bio7", "bio11", "bio19"))
colibri_models_proj_2070<- BIOMOD_Projection(
bm.mod= colibri_models,
new.env = bioclim_sa_70_st,
proj.name = "future_2070",
metric.binary = "TSS",
output.format = ".img",
do.stack = FALSE)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Building clamping mask
##
## > Projecting Colibri.coruscans_PA1_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA1_RUN1_RF ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA2_RUN1_RF ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GLM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GBM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_GAM ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_PA3_RUN1_RF ...
## Writing projection on hard drive...
##
## > Building TSS binaries / filtered
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
colibri_ensemble_models_proj_2070<-BIOMOD_EnsembleForecasting(
bm.em = colibri_ensemble_models,
bm.proj = colibri_models_proj_2070,
metric.binary = "TSS",
output.format = ".img",
do.stack = FALSE)
##
## -=-=-=-=-=-=-=-=-=-=-=-= Do Ensemble Models Projection -=-=-=-=-=-=-=-=-=-=-=-=
##
## Creating suitable Workdir...
##
## > Projecting Colibri.coruscans_EMmeanByTSS_mergedData_mergedRun_mergedAlgo ...
## Writing projection on hard drive...
## > Projecting Colibri.coruscans_EMcaByTSS_mergedData_mergedRun_mergedAlgo ...
## Writing projection on hard drive...
##
## > Building TSS binaries / filtered
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
stk_colibri_ef_2070<-
get_predictions(colibri_ensemble_models_proj_2070)
stk_colibri_ef_2070<-subset(stk_colibri_ef_2070,
grep("EMca|EMmean", names(stk_colibri_ef_2070)))
names(stk_colibri_ef_2070) <-
sapply(strsplit(names(stk_colibri_ef_2070), "_"),
getElement, 2)
levelplot(stk_colibri_ef_2070,
main = "Colibri coruscans ensemble projections\nin 2070
",
col.regions = colorRampPalette(c("grey90", "yellow4", "green4"))
(100))
colibri_bin_proj_curr<- stack(c(
wm="Colibri.coruscans/proj_current/individual_projections/Colibri.coruscans_EMmeanByTSS_mergedData_mergedRun_mergedAlgo_TSSbin.img"),
ca="Colibri.coruscans/proj_current/individual_projections/Colibri.coruscans_EMcaByTSS_mergedData_mergedRun_mergedAlgo_TSSbin.img")
colibri_bin_proj_2050<- stack(c(
wm="Colibri.coruscans/proj_future_2050/individual_projections/Colibri.coruscans_EMmeanByTSS_mergedData_mergedRun_mergedAlgo_TSSbin.img"),
ca="Colibri.coruscans/proj_future_2050/individual_projections/Colibri.coruscans_EMcaByTSS_mergedData_mergedRun_mergedAlgo_TSSbin.img")
colibri_bin_proj_2070<- stack(c(
wm="Colibri.coruscans/proj_future_2070/individual_projections/Colibri.coruscans_EMmeanByTSS_mergedData_mergedRun_mergedAlgo_TSSbin.img"),
ca="Colibri.coruscans/proj_future_2070/individual_projections/Colibri.coruscans_EMcaByTSS_mergedData_mergedRun_mergedAlgo_TSSbin.img")
SCR_current_2050<- BIOMOD_RangeSize(
proj.current=colibri_bin_proj_curr, proj.future =colibri_bin_proj_2050)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= Do Range Size Computation -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## Each projection in 'proj.current' will be compared once with its corresponding projection in 'proj.future'.
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SCR_current_2050$Compt.By.Models
## Loss Stable0 Stable1 Gain PercLoss PercGain SpeciesRangeChange
## wm 0 54970 2476 0 0 0 0
## ca 0 55272 2174 0 0 0 0
## CurrentRangeSize FutureRangeSize.NoDisp FutureRangeSize.FullDisp
## wm 2476 2476 2476
## ca 2174 2174 2174
SCR_current_2070<- BIOMOD_RangeSize(
proj.current=colibri_bin_proj_curr, proj.future =colibri_bin_proj_2070)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= Do Range Size Computation -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## Each projection in 'proj.current' will be compared once with its corresponding projection in 'proj.future'.
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SCR_current_2070$Compt.By.Models
## Loss Stable0 Stable1 Gain PercLoss PercGain SpeciesRangeChange
## wm 332 54784 2144 186 13.409 7.512 -5.897
## ca 342 55094 1832 178 15.731 8.188 -7.544
## CurrentRangeSize FutureRangeSize.NoDisp FutureRangeSize.FullDisp
## wm 2476 2144 2330
## ca 2174 1832 2010
colibri_src_map <- rast(list(SCR_current_2050$Diff.By.Pixel,
SCR_current_2070$Diff.By.Pixel))
names(colibri_src_map) <- c("ca_cur.2050", "wm_cur.2050", "ca_cur.2070", "wm_cur.2070")
my.at<-seq(-2.5, 1.5, 1)
myColorkey <- list(at = my.at,
labels= list(labels=c("lost", "pres", "abs", "gain"),
##Labels
at= my.at[-1]-0.5 # where to print labels
))
rasterVis::levelplot(colibri_src_map,
main="Colibri coruscans range change",
colorkey= myColorkey, layout=c(2,2))