Fit the models - Step 14/14

So now we will use the other two replicates using the same parameters that we showed for the first replicate.

> for(i in 2:length(krameri))
> {
 mydata<-BIOMOD_FormatingData(resp.var=rep(1, nrow(krameri[[i]])), <%6%5%> expl.var=vars_training,
PA.nb.rep=1,
PA.nb.absences=1000,
PA.strategy='random',
resp.xy=krameri[[i]],
resp.name=paste("krameri.", i, sep=""))

 mymodel<-BIOMOD_Modeling(data=mydata, <%6%5%> models=c('GLM','GAM','GBM','MAXENT'),
models.options=myBiomodOption,
NbRunEval=3,
DataSplit=70,
VarImport=2,
models.eval.meth=c('ROC', 'TSS'),
do.full.models=F)

 myEM<-BIOMOD_EnsembleModeling(modeling.output=mymodel,<%6%5%> em.by="all",
eval.metric=c('ROC','TSS'),
eval.metric.quality.threshold=c(0.7,0.4),
models.eval.meth = c('ROC', 'TSS'),
prob.mean=F,
prob.mean.weight=T)

 ## to save time we select for projections only those models that passed the threshold

 sel.mod<-lapply(myEM@em.models, function(x)x@model)<%6%5%>  sel.mod<-unique(do.call(c, sel.mod[grep("wmean",names(sel.mod))]))<%6%5%>
 myproj<-BIOMOD_Projection(modeling.output=mymodel,<%6%5%> new.env=vars_proj,
proj.name="current",
selected.models=sel.mod,
do.stack=T)

 myEF<-BIOMOD_EnsembleForecasting(EM.output=myEM,<%6%5%> projection.output=myproj,
total.consensus=T,
binary.meth=c("TSS"))

 myproj<-BIOMOD_Projection(modeling.output=mymodel,<%6%5%> new.env=future,
proj.name="future",
selected.models=sel.mod,
do.stack=T)

 myEF<-BIOMOD_EnsembleForecasting(EM.output=myEM,<%6%5%> projection.output=myproj,
total.consensus=T,
binary.meth=c("TSS"))
}

At the end of this procedure we have 6 ensemble SDMs for P. krameri, 3 for current and 3 for future climatic conditions at a global scale. In the next module we will produce the 2 final ensemble SDMs by averaging these models, and we will do some test to evaluate the goodness of our models.