The output interpretation and test of robustness
Obtaining the final model and Interpretation of the results - Step 1/6
First of all, we need to load the output of the ensemble models.
l<-list.files(getwd(), "ensemble.models.out", recursive=T, full.names=T)
> for(i in 1:length(l))
+ {
+ load(l[i])
+ }
>
> myEM<-lapply(grep("ensemble.models.out", ls(), value=T), get)
Loading required package: biomod2
Loading required package: sp
Loading required package: raster
Loading required package: parallel
Loading required package: reshape
biomod2 3.1-54 loaded.
Now, we will get the TSS and ROC scores with the get_evaluations() function of biomod2.
> library(biomod2)
> TSS<-unlist(lapply(myEM, get_evaluations), recursive=F)
By default, when asked to build weighted ensemble models, biomod2 calculates an ensemble for each evaluation metric used as weight. In this case, we will consider just the ensemble obtained averaging the single models’ predictions with the TSS as weight. The “TSS” object in the strings below will be used later on as the weight vector for the final ensemble.
> ROC<-sapply(TSS[grep("TSS", names(TSS))], "[[", c(1))
> TSS<-sapply(TSS[grep("TSS", names(TSS))], "[[", c(2))
Have a look at the TSS scores
> TSS
| krameri.1_TotalConsensus_TSS_EMwmean | krameri.2_TotalConsensus_TSS_EMwmean | krameri.3_TotalConsensus_TSS_EMwmean |
| 0.501 | 0.487 | 0.460 |