<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Dear Sami,</div><div><br></div><div>Funny enough, despite the answer to your email is relatively easy, by looking at the code, I discovered a problem that I just fixed. Thanks a lot!&nbsp;</div><div><br></div><div>You understood almost correctly.&nbsp;</div><div><br></div><div>If in the Ensemble.Forecasting call, you have "<span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; ">repetition.models</span><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; "><span style="color: #042299">=</span></span><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; ">T", then f</span>or the binary transformation apply to Total.Consensus, we take the AVERAGE of the thresholds (and not only PA1). In your example, PA1, PA1_rep1, and PA1_rep2).</div><div><br></div><div>If you do not want the repetition added to the ensemble forecast, just replace&nbsp;"<span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; ">repetition.models</span><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; "><span style="color: rgb(4, 34, 153); ">=F</span></span><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; ">".</span></div><div><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; "><br></span></div><div><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; ">Alternatively, you can also remove the projections made with the full model (run on all data) and only keep the average over the different repetitions (made on sub-parts of the data). For this you just to have to put: final.model.out = TRUE.&nbsp;</span></div><div><font class="Apple-style-span" color="#007128">There was a bug here, a local variable that was removed accidentally during the process. I fixed it.&nbsp;</font></div><div><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; "><br></span></div><div><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; ">Look at your example below where I run the two cases. Everything works fine.&nbsp;</span></div><div><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; ">&nbsp;</span></div><div>In the mean time, I have also modified the two functions Ensemble.Forecasting and&nbsp;Ensemble.Forecasting.raster to allow the binary transformation for the median as well. The threshold is set to the median of the thresholds.</div><div><br></div><div>I have uploaded the new functions on R-Forge tonight (rev 258, version 1.1-6.3). Because R-Forge is always a bit long to compile the packages, I have also attached the two updated scripts. If you want to use them already, first load BIOMOD, and then "source" the two scripts.&nbsp;</div><div>Please note that I have not tested the Ensemble.Forecasting.raster with these changes. Any bug report is more than welcome (only the binary transformation by the median has been changed).&nbsp;</div><div><br></div><div>library(BIOMOD)</div><div>source("PATH/Ensemble.Forecasting") &nbsp;### make sure &nbsp;to set up the correct path to the file)</div><div><br></div><div>Hope it helps,</div><div>Wilfried</div><div><br></div><div><br></div><div>#####################################################</div><div>#### Examples to show the results with and without the "full model".</div><div><br></div><div><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">library<span style="color: #042299">(</span>BIOMOD<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">data<span style="color: #042299">(</span>Sp.Env<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">Initial.State<span style="color: #042299">(</span>Response<span style="color: #042299">=</span>Sp.Env<span style="color: #042299">[, </span>c<span style="color: #042299">(</span><span style="color: #2b6fb8">17</span><span style="color: #042299">:</span><span style="color: #2b6fb8">18</span><span style="color: #042299">)], </span>Explanatory<span style="color: #042299"> = </span>Sp.Env<span style="color: #042299">[,</span>c<span style="color: #042299">(</span><span style="color: #2b6fb8">4</span><span style="color: #042299">:</span><span style="color: #2b6fb8">10</span><span style="color: #042299">)], </span>IndependentResponse<span style="color: #042299"> = </span><span style="color: #db224a">NULL</span><span style="color: #042299">, </span>IndependentExplanatory<span style="color: #042299"> = </span><span style="color: #db224a">NULL</span><span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">Models<span style="color: #042299">(</span>GLM<span style="color: #042299"> = </span>T<span style="color: #042299">, </span>TypeGLM<span style="color: #042299"> = </span><span style="color: #b0140c">"poly"</span><span style="color: #042299">, </span>Test<span style="color: #042299"> = </span><span style="color: #b0140c">"AIC"</span><span style="color: #042299">, </span>GBM<span style="color: #042299"> = </span>F<span style="color: #042299">, </span>No.trees<span style="color: #042299"> = </span><span style="color: #2b6fb8">3000</span><span style="color: #042299">,</span>GAM<span style="color: #042299"> = </span>F<span style="color: #042299">, </span>Spline<span style="color: #042299"> = </span><span style="color: #2b6fb8">3</span><span style="color: #042299">,</span>CTA<span style="color: #042299"> = </span>T<span style="color: #042299">, </span>CV.tree<span style="color: #042299"> = </span><span style="color: #2b6fb8">50</span><span style="color: #042299">,</span>ANN<span style="color: #042299"> = </span>F<span style="color: #042299">, </span>CV.ann<span style="color: #042299"> = </span><span style="color: #2b6fb8">2</span><span style="color: #042299">,</span>FDA<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>SRE<span style="color: #042299"> = </span>F<span style="color: #042299">, </span>quant<span style="color: #042299">=</span><span style="color: #2b6fb8">0.025</span><span style="color: #042299">,</span>MARS<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>RF<span style="color: #042299"> = </span>T<span style="color: #042299">,</span>NbRunEval<span style="color: #042299"> = </span><span style="color: #2b6fb8">2</span><span style="color: #042299">, </span>DataSplit<span style="color: #042299"> = </span><span style="color: #2b6fb8">70</span><span style="color: #042299">,</span>Yweights<span style="color: #042299">=</span><span style="color: #db224a">NULL</span><span style="color: #042299">, </span>Roc<span style="color: #042299">=</span><span style="color: #db224a">TRUE</span><span style="color: #042299">,</span>Optimized.Threshold.Roc<span style="color: #042299">=</span><span style="color: #db224a">TRUE</span><span style="color: #042299">,</span>Kappa<span style="color: #042299">=</span><span style="color: #db224a">TRUE</span><span style="color: #042299">, </span>TSS<span style="color: #042299">=</span><span style="color: #db224a">TRUE</span><span style="color: #042299">, </span>KeepPredIndependent<span style="color: #042299"> = </span><span style="color: #db224a">FALSE</span><span style="color: #042299">, </span>VarImport<span style="color: #042299">=</span><span style="color: #2b6fb8">5</span><span style="color: #042299">,</span>NbRepPA<span style="color: #042299">=</span><span style="color: #2b6fb8">1</span><span style="color: #042299">,</span>strategy<span style="color: #042299">=</span><span style="color: #b0140c">"random"</span><span style="color: #042299">,</span>nb.absences<span style="color: #042299">=</span><span style="color: #2b6fb8">1000</span><span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">Projection<span style="color: #042299">(</span>Proj<span style="color: #042299"> = </span>Sp.Env<span style="color: #042299">[,</span><span style="color: #2b6fb8">4</span><span style="color: #042299">:</span><span style="color: #2b6fb8">10</span><span style="color: #042299">],</span><a href="http://Proj.name">Proj.name</a><span style="color: #042299">=</span><span style="color: #b0140c">'present'</span><span style="color: #042299">,</span>GLM<span style="color: #042299"> = </span>T<span style="color: #042299">,</span>GBM<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>GAM<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>CTA<span style="color: #042299"> = </span>T<span style="color: #042299">,</span>ANN<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>FDA<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>SRE<span style="color: #042299"> = </span>F<span style="color: #042299">, </span>quant<span style="color: #042299">=</span><span style="color: #2b6fb8">0.025</span><span style="color: #042299">,</span>MARS<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>RF<span style="color: #042299"> = </span>T<span style="color: #042299">,</span>BinRoc<span style="color: #042299"> = </span>T<span style="color: #042299">, </span>BinKappa<span style="color: #042299"> = </span>F<span style="color: #042299">, </span>BinTSS<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>FiltRoc<span style="color: #042299"> = </span>F<span style="color: #042299">, </span>FiltKappa<span style="color: #042299"> = </span>F<span style="color: #042299">, </span>FiltTSS<span style="color: #042299"> = </span>F<span style="color: #042299">,</span>repetition.models<span style="color: #042299">=</span>T<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">Ensemble.Forecasting<span style="color: #042299">(</span><a href="http://Proj.name">Proj.name</a><span style="color: #042299">= </span><span style="color: #b0140c">"present"</span><span style="color: #042299">,</span>weight.method<span style="color: #042299">=</span><span style="color: #b0140c">'Roc'</span><span style="color: #042299">,</span>PCA.median<span style="color: #042299">=</span>F<span style="color: #042299">,</span>binary<span style="color: #042299">=</span>T<span style="color: #042299">,</span>bin.method<span style="color: #042299">=</span><span style="color: #b0140c">'Roc'</span><span style="color: #042299">,</span>Test<span style="color: #042299">=</span>T<span style="color: #042299">,</span>decay<span style="color: #042299">=</span><span style="color: #2b6fb8">1.6</span><span style="color: #042299">,</span>repetition.models<span style="color: #042299">=</span>T,&nbsp;<span style="color: rgb(4, 34, 153); ">,&nbsp;</span><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; ">final.model.out</span><span class="Apple-style-span" style="color: rgb(0, 113, 40); font-size: 12px; "><span style="color: rgb(4, 34, 153); ">=</span>F</span><span class="Apple-style-span" style="color: rgb(4, 34, 153); ">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(169, 65, 203); "># check outputs:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(169, 65, 203); "># binary output:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(176, 20, 12); "><span style="color: #007128">load</span><span style="color: #042299">(</span>"proj.present/Total_consensus_present_Bin"<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">binary_weighted_average<span style="color: #042299"> &lt;- </span>Total_consensus_present_Bin<span style="color: #042299">[,,</span><span style="color: #2b6fb8">3</span><span style="color: #042299">]</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">apply<span style="color: #042299">(</span>binary_weighted_average<span style="color: #042299">, </span><span style="color: #2b6fb8">2</span><span style="color: #042299">, </span>sum<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(176, 20, 12); "><span style="color: #007128">load</span><span style="color: #042299">(</span>"proj.present/Total_consensus_present"<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">probs_weighted_average<span style="color: #042299"> &lt;- </span>Total_consensus_present<span style="color: #042299">[,,</span><span style="color: #2b6fb8">3</span><span style="color: #042299">]</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(176, 20, 12); "><span style="color: #007128">load</span><span style="color: #042299">(</span>"proj.present/consensus_present_results"<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">sum<span style="color: #042299">(</span>BinaryTransformation<span style="color: #042299">(</span>probs_weighted_average<span style="color: #042299">[,</span><span style="color: #2b6fb8">1</span><span style="color: #042299">], </span>mean<span style="color: #042299">(</span>consensus_present_results<span style="color: #042299">[[</span><span style="color: #2b6fb8">1</span><span style="color: #042299">]][[</span><span style="color: #2b6fb8">3</span><span style="color: #042299">]][</span><span style="color: #2b6fb8">2</span><span style="color: #042299">,])))</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">sum<span style="color: #042299">(</span>BinaryTransformation<span style="color: #042299">(</span>probs_weighted_average<span style="color: #042299">[,</span><span style="color: #2b6fb8">2</span><span style="color: #042299">], </span>mean<span style="color: #042299">(</span>consensus_present_results<span style="color: #042299">[[</span><span style="color: #2b6fb8">2</span><span style="color: #042299">]][[</span><span style="color: #2b6fb8">3</span><span style="color: #042299">]][</span><span style="color: #2b6fb8">2</span><span style="color: #042299">,])))</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(169, 65, 203); ">#### WITHOUT FULL MODEL</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">Ensemble.Forecasting<span style="color: #042299">(</span><a href="http://Proj.name">Proj.name</a><span style="color: #042299">= </span><span style="color: #b0140c">"present"</span><span style="color: #042299">,</span>weight.method<span style="color: #042299">=</span><span style="color: #b0140c">'Roc'</span><span style="color: #042299">,</span>PCA.median<span style="color: #042299">=</span>F<span style="color: #042299">,</span>binary<span style="color: #042299">=</span>T<span style="color: #042299">,</span>bin.method<span style="color: #042299">=</span><span style="color: #b0140c">'Roc'</span><span style="color: #042299">,</span>Test<span style="color: #042299">=</span>T<span style="color: #042299">,</span>decay<span style="color: #042299">=</span><span style="color: #2b6fb8">1.6</span><span style="color: #042299">,</span>repetition.models<span style="color: #042299">=</span>T<span style="color: #042299">, </span>final.model.out<span style="color: #042299">=</span>T<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(169, 65, 203); "># check outputs:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(169, 65, 203); "># binary output: WITHOUT FULL MODELS</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(176, 20, 12); "><span style="color: #007128">load</span><span style="color: #042299">(</span>"proj.present/Total_consensus_present_Bin"<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">binary_weighted_average<span style="color: #042299"> &lt;- </span>Total_consensus_present_Bin<span style="color: #042299">[,,</span><span style="color: #2b6fb8">3</span><span style="color: #042299">]</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">apply<span style="color: #042299">(</span>binary_weighted_average<span style="color: #042299">, </span><span style="color: #2b6fb8">2</span><span style="color: #042299">, </span>sum<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(176, 20, 12); "><span style="color: #007128">load</span><span style="color: #042299">(</span>"proj.present/Total_consensus_present"<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">probs_weighted_average<span style="color: #042299"> &lt;- </span>Total_consensus_present<span style="color: #042299">[,,</span><span style="color: #2b6fb8">3</span><span style="color: #042299">]</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(176, 20, 12); "><span style="color: #007128">load</span><span style="color: #042299">(</span>"proj.present/consensus_present_results"<span style="color: #042299">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">sum<span style="color: #042299">(</span>BinaryTransformation<span style="color: #042299">(</span>probs_weighted_average<span style="color: #042299">[,</span><span style="color: #2b6fb8">1</span><span style="color: #042299">], </span>mean<span style="color: #042299">(</span>consensus_present_results<span style="color: #042299">[[</span><span style="color: #2b6fb8">1</span><span style="color: #042299">]][[</span><span style="color: #2b6fb8">3</span><span style="color: #042299">]][</span><span style="color: #2b6fb8">3</span><span style="color: #042299">,</span><span style="color: #2b6fb8">2</span><span style="color: #042299">:</span><span style="color: #2b6fb8">3</span><span style="color: #042299">])))</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(0, 113, 40); ">sum<span style="color: #042299">(</span>BinaryTransformation<span style="color: #042299">(</span>probs_weighted_average<span style="color: #042299">[,</span><span style="color: #2b6fb8">2</span><span style="color: #042299">], </span>mean<span style="color: #042299">(</span>consensus_present_results<span style="color: #042299">[[</span><span style="color: #2b6fb8">2</span><span style="color: #042299">]][[</span><span style="color: #2b6fb8">3</span><span style="color: #042299">]][</span><span style="color: #2b6fb8">3</span><span style="color: #042299">,</span><span style="color: #2b6fb8">2</span><span style="color: #042299">:</span><span style="color: #2b6fb8">3</span><span style="color: #042299">])))</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; color: rgb(4, 34, 153); min-height: 14px; "><br></div><div>&nbsp;</div><div><br></div><div><br></div><br><div><div>Le 20 janv. 2011 à 19:12, Sami Domisch a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Dear modellers, <br><br>I have a question related to the method, how BIOMOD creates the binary consensus predictions. I played a bit around with the test data which comes with the package, and modelled the present distribution of 2 species (Sp185, Sp191) with 3 algorithms (GLM, CTA, RF x 2 repetitions each, one pseudo-absence-run to keep it simple and fast..). I used the Projection-function using the same present-day variables in order to receive the present-day distribution for the whole study area. Subsequently I used the Ensemble.Forecasting-function to get a consensus model using weighted averages (prob.mean.weighted, weight decay 1.6). So far nothing special about it, I pasted the code below.<br><br>I now compared the binary consensus output BIOMOD created for the two species (i.e. prob.mean.weighted in "Total_consensus_present_Bin") with the probability-output (0-1000) of the consensus prob.mean.weighted-model, after applying the prob.mean.weighted - threshold which is given in the "consensus_present_results"-table (PA1, which used the total data of the two repetitions PA1_rep1 and PA1_rep2). I thus created the binary results manually.<br><br>Now here is my problem: the number of presence-pixels ("1") differ between the two outputs, although they should be identical. For instance, Sp185 and Sp191 have 736 and 1217 presence-pixels, respectively, whereas the manually calculated ones have 678 and 1149 pixels classified as "1". Shouldn't the numbers be the same? How is BIOMOD creating the binary results, did I miss something? I guess this derives from the partitioning of the train/test-data vs. using the total data? <br><br>I am interested in a solution since I want to average several projections for one species based on different climate scenarios, and binary maps would be essential for me. The idea was quite simple: to average the probabilities of the different climate-scenario runs for each grid cell, and then average the thresholds of these runs to get the binary outputs. And to check this method, I compared the BIOMOD-output and the manually calculated one. However there seems to be some kind of discrepancy...Has anybody a solution or maybe knows a work-around for this issue?<br>Any help is appreciated, many thanks in advance!<br>Sami<br><br><br>#############<br><br>load("Sp.Env.rda")<br><br>library(BIOMOD)<br><br>Initial.State(Response=Sp.Env[, c(17:18)], Explanatory = Sp.Env[,c(4:10)],<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndependentResponse = NULL, IndependentExplanatory = NULL)<br><br>Models( &nbsp;&nbsp;&nbsp;GLM = T, TypeGLM = "poly", Test = "AIC", <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GBM = F, No.trees = 3000,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GAM = F, Spline = 3,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CTA = T, CV.tree = 50,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ANN = F, CV.ann = 2,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FDA = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SRE = F, quant=0.025,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MARS = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RF = T,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NbRunEval = 2, DataSplit = 70,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Yweights=NULL, Roc=TRUE, Optimized.Threshold.Roc=TRUE,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kappa=TRUE, TSS=TRUE, KeepPredIndependent = FALSE, VarImport=5,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NbRepPA=1, strategy="random",<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nb.absences=1000)<br><br><br>Projection(Proj = Sp.Env[,4:10],<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Proj.name='present',<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GLM = T,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GBM = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GAM = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CTA = T,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ANN = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FDA = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SRE = F, quant=0.025,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MARS = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RF = T,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BinRoc = T, BinKappa = F, BinTSS = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FiltRoc = F, FiltKappa = F, FiltTSS = F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repetition.models=T)<br><br><br>Ensemble.Forecasting(Proj.name= "present",<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;weight.method='Roc',<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PCA.median=F,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;binary=T,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bin.method='Roc',<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Test=T,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;decay=1.6,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repetition.models=T)<br><br><br># check outputs:<br><br># binary output:<br>load("proj.present/Total_consensus_present_Bin")<br>binary_weighted_average &lt;- Total_consensus_present_Bin[,,2]<br>write.csv( binary_weighted_average, "binary_weighted_average.csv")<br><br><br># probs 0-1000:<br>load("proj.present/Total_consensus_present")<br>probs_weighted_average &lt;- Total_consensus_present[,,2]<br>write.csv(probs_weighted_average, "probs_weighted_average.csv")<br><br># get appropriate threshold for prob.mean.weighted:<br>consensus_present_results<br><br>#############<br><br>_______________________________________________<br>Biomod-commits mailing list<br><a href="mailto:Biomod-commits@lists.r-forge.r-project.org">Biomod-commits@lists.r-forge.r-project.org</a><br>https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits<br></div></blockquote></div><br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="font-size: 12px; "><div>--------------------------</div><div>Dr. Wilfried Thuiller</div><div>Laboratoire d'Ecologie Alpine, UMR CNRS 5553</div><div>Université Joseph Fourier</div><div>BP53, 38041 Grenoble cedex 9, France</div><div>tel: +33 (0)4 76 51 44 97</div><div>fax: +33 (0)4 76 51 42 79</div><div><br></div><div>Email:&nbsp;<a href="mailto:wilfried.thuiller@ujf-grenoble.fr">wilfried.thuiller@ujf-grenoble.fr</a><br>Home page:&nbsp;<a href="http://www.will.chez-alice.fr/">http://www.will.chez-alice.fr</a><br>Website:&nbsp;<a href="http://www-leca.ujf-grenoble.fr/equipes/tde.htm">http://www-leca.ujf-grenoble.fr/equipes/tde.htm</a><br><br>FP6 European MACIS project:&nbsp;<a href="http://www.macis-project.net/">http://www.macis-project.net</a><br>FP6 European EcoChange project:&nbsp;<a href="http://www.ecochange-project.eu/">http://www.ecochange-project.eu</a></div><div><br></div></span></div></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></body></html>