<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Dear Emilie, dear all,</div><div><br></div><div>I have patched the response curve function to overlay the response curves for all selected models. </div><div>This is really cool actually! The results are quite nice. </div><div>Please find attached the new function. Once BIOMOD is loaded, source this one.</div><div><br></div><div>source("PATH/response.plot.R")</div><div><br></div><div>Compared to the former function, there is one argument more: plot=TRUE/FALSE</div><div>If you put plot=TRUE, this is the same than the former one</div><div>If you put plot=FALSE, a 3-D array object is returned. This 3-D array contains:</div><div><br></div><div>First dimension: the same number of rows than the original data</div><div>Second dimension: 2 columns: The first one is the explanatory variable to plot, the second one, the probability of occurrence to plot</div><div>Third dimension: The set of environmental variables for which the response.plot was asked to run. </div><div><br></div><div>I have tried with the following code: </div><div><br></div><div>### Only three models are selected (GLM, FDA and RandomForest)</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(0, 113, 40); "><span style="color: #042299">Initial.State(</span>Response<span style="color: #042299">=</span>Sp.Env<span style="color: #042299">[,</span><span style="color: #2b6fb8">12</span><span style="color: #042299">:</span><span style="color: #2b6fb8">13</span><span style="color: #042299">],</span><span style="color: #000000"> </span>Explanatory<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></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(0, 113, 40); "><span style="color: #042299">Models(</span>GLM<span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #db224a">TRUE</span><span style="color: #042299">,</span><span style="color: #000000"> </span>TypeGLM<span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #b0140c">"quad"</span><span style="color: #042299">,</span><span style="color: #000000"> </span>Test<span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #b0140c">"AIC"</span><span style="color: #042299">,</span><span style="color: #000000"> </span>FDA<span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #db224a">TRUE</span><span style="color: #042299">,</span><span style="color: #000000"> </span>RF<span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #db224a">TRUE</span><span style="color: #042299">,</span><span style="color: #000000"> </span>NbRunEval<span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #2b6fb8">0</span><span style="color: #042299">,</span><span style="color: #000000"> </span>Roc<span style="color: #042299">=</span><span style="color: #db224a">T</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 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; ">### Load back all models for the first species. </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">LoadModels(<span style="color: #007128">Sp</span>=<span style="color: #2b6fb8">1</span>,<span style="color: #000000"> </span><span style="color: #007128">PA</span>=<span style="color: #b0140c">'all'</span>,<span style="color: #000000"> </span><span style="color: #007128">rep</span>=<span style="color: #2b6fb8">1</span>,<span style="color: #000000"> </span><span style="color: #007128">models</span>=<span style="color: #b0140c">'all'</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; ">### Save the object return by the new response.plot function</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(0, 113, 40); ">GLM.RC<span style="color: #000000"> </span><span style="color: #042299"><-</span><span style="color: #000000"> </span><span style="color: #042299">response.plot(</span>Sp290_GLM_full<span style="color: #042299">,</span><span style="color: #000000"> </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><span style="color: #000000"> </span>plot<span style="color: #042299">=</span><span style="color: #db224a">F</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 13px/normal Courier; color: rgb(0, 113, 40); ">FDA.RC<span style="color: #000000"> </span><span style="color: #042299"><-</span><span style="color: #000000"> </span><span style="color: #042299">response.plot(</span>Sp290_FDA_full<span style="color: #042299">,</span><span style="color: #000000"> </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><span style="color: #000000"> </span>plot<span style="color: #042299">=</span><span style="color: #db224a">F</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 13px/normal Courier; color: rgb(0, 113, 40); ">RF.RC<span style="color: #000000"> </span><span style="color: #042299"><-</span><span style="color: #000000"> </span><span style="color: #042299">response.plot(</span>Sp290_RF_full<span style="color: #042299">,</span><span style="color: #000000"> </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><span style="color: #000000"> </span>plot<span style="color: #042299">=</span><span style="color: #db224a">F</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 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; ">### plot the response for GLM for the first variable (the 1 for the third dimension)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">plot(<span style="color: #007128">GLM.RC</span>[,<span style="color: #2b6fb8">1</span>,<span style="color: #2b6fb8">1</span>],<span style="color: #000000"> </span><span style="color: #007128">GLM.RC</span>[,<span style="color: #2b6fb8">2</span>,<span style="color: #2b6fb8">1</span>],<span style="color: #000000"> </span><span style="color: #007128">type</span>=<span style="color: #b0140c">"l"</span>,<span style="color: #000000"> </span><span style="color: #007128">ylim</span>=c(<span style="color: #2b6fb8">0</span>,<span style="color: #2b6fb8">1</span>),<span style="color: #000000"> </span><span style="color: #007128">xlab</span>=colnames(<span style="color: #007128">GLM.RC</span>[,<span style="color: #2b6fb8">1</span>,])[<span style="color: #2b6fb8">1</span>],<span style="color: #000000"> </span><span style="color: #007128">ylab</span>=<span style="color: #b0140c">"Probability of occurrence"</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">### then add the lines for the two other models with different colors</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">lines(<span style="color: #007128">FDA.RC</span>[,<span style="color: #2b6fb8">1</span>,<span style="color: #2b6fb8">1</span>],<span style="color: #000000"> </span><span style="color: #007128">FDA.RC</span>[,<span style="color: #2b6fb8">2</span>,<span style="color: #2b6fb8">1</span>],<span style="color: #000000"> </span><span style="color: #007128">col</span>=<span style="color: #b0140c">'blue'</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">lines(<span style="color: #007128">RF.RC</span>[,<span style="color: #2b6fb8">1</span>,<span style="color: #2b6fb8">1</span>],<span style="color: #000000"> </span><span style="color: #007128">RF.RC</span>[,<span style="color: #2b6fb8">2</span>,<span style="color: #2b6fb8">1</span>],<span style="color: #000000"> </span><span style="color: #007128">col</span>=<span style="color: #b0140c">'red'</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">### load the gplots package to make nice and user-friendly legends.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">library(<span style="color: #007128">plots</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">### add a legend</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(176, 20, 12); "><span style="color: #042299">smartlegend(</span><span style="color: #007128">x</span><span style="color: #042299">=</span>"left"<span style="color: #042299">,</span><span style="color: #007128">y</span><span style="color: #042299">=</span>"top"<span style="color: #042299">,</span><span style="color: #000000"> </span><span style="color: #007128">inset</span><span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #2b6fb8">0</span><span style="color: #042299">,</span><span style="color: #000000"> </span><span style="color: #042299">c(</span>"GLM"<span style="color: #042299">,</span><span style="color: #000000"> </span>"FDA"<span style="color: #042299">,</span><span style="color: #000000"> </span>"RF"<span style="color: #042299">),</span><span style="color: #000000"> </span><span style="color: #007128">fill</span><span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #042299">c(</span>"black"<span style="color: #042299">,</span><span style="color: #000000"> </span>"blue"<span style="color: #042299">,</span><span style="color: #000000"> </span>"red"<span style="color: #042299">))</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; ">#### the same but with all variables plotted in the same plot window. </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">library(<span style="color: #007128">gplots</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">par(<span style="color: #007128">mfrow</span>=c(<span style="color: #2b6fb8">3</span>,<span style="color: #2b6fb8">3</span>))</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); "><span style="color: #db224a">for</span>(<span style="color: #007128">i</span><span style="color: #000000"> </span><span style="color: #db224a">in</span><span style="color: #000000"> </span><span style="color: #2b6fb8">1</span>:ncol(<span style="color: #007128">Sp.Env</span>[,<span style="color: #2b6fb8">4</span>:<span style="color: #2b6fb8">10</span>])){</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Courier; min-height: 16.0px"><span class="Apple-tab-span" style="white-space:pre"> </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"> </span></span>plot(<span style="color: #007128">GLM.RC</span>[,<span style="color: #2b6fb8">1</span>,<span style="color: #007128">i</span>],<span style="color: #000000"> </span><span style="color: #007128">GLM.RC</span>[,<span style="color: #2b6fb8">2</span>,<span style="color: #007128">i</span>],<span style="color: #000000"> </span><span style="color: #007128">type</span>=<span style="color: #b0140c">"l"</span>,<span style="color: #000000"> </span><span style="color: #007128">ylim</span>=c(<span style="color: #2b6fb8">0</span>,<span style="color: #2b6fb8">1</span>),<span style="color: #000000"> </span><span style="color: #007128">xlab</span>=colnames(<span style="color: #007128">GLM.RC</span>[,<span style="color: #2b6fb8">1</span>,])[<span style="color: #007128">i</span>],<span style="color: #000000"> </span><span style="color: #007128">ylab</span>=<span style="color: #b0140c">"Probability of occurrence"</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"> </span></span>lines(<span style="color: #007128">FDA.RC</span>[,<span style="color: #2b6fb8">1</span>,<span style="color: #007128">i</span>],<span style="color: #000000"> </span><span style="color: #007128">FDA.RC</span>[,<span style="color: #2b6fb8">2</span>,<span style="color: #007128">i</span>],<span style="color: #000000"> </span><span style="color: #007128">col</span>=<span style="color: #b0140c">'blue'</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"> </span></span>lines(<span style="color: #007128">RF.RC</span>[,<span style="color: #2b6fb8">1</span>,<span style="color: #007128">i</span>],<span style="color: #000000"> </span><span style="color: #007128">RF.RC</span>[,<span style="color: #2b6fb8">2</span>,<span style="color: #007128">i</span>],<span style="color: #000000"> </span><span style="color: #007128">col</span>=<span style="color: #b0140c">'red'</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(176, 20, 12); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="color: #042299">smartlegend(</span><span style="color: #007128">x</span><span style="color: #042299">=</span>"left"<span style="color: #042299">,</span><span style="color: #007128">y</span><span style="color: #042299">=</span>"top"<span style="color: #042299">,</span><span style="color: #000000"> </span><span style="color: #007128">inset</span><span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #2b6fb8">0</span><span style="color: #042299">,</span><span style="color: #000000"> </span><span style="color: #042299">c(</span>"GLM"<span style="color: #042299">,</span><span style="color: #000000"> </span>"FDA"<span style="color: #042299">,</span><span style="color: #000000"> </span>"RF"<span style="color: #042299">),</span><span style="color: #000000"> </span><span style="color: #007128">fill</span><span style="color: #000000"> </span><span style="color: #042299">=</span><span style="color: #000000"> </span><span style="color: #042299">c(</span>"black"<span style="color: #042299">,</span><span style="color: #000000"> </span>"blue"<span style="color: #042299">,</span><span style="color: #000000"> </span>"red"<span style="color: #042299">),</span><span style="color: #007128">cex</span><span style="color: #042299">=</span><span style="color: #2b6fb8">0.6</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 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; "><br></div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Courier; min-height: 16.0px"><span class="Apple-tab-span" style="white-space:pre"> </span><br class="webkit-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Courier; min-height: 16.0px"><span class="Apple-tab-span" style="white-space:pre"> </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; color: rgb(4, 34, 153); ">}</div></div><div><br></div><div><br></div><div>Hope it helps. This is very likely that we will replace the former response.plot function by this new one. Thanks Emilie for the question! ;-)</div><div><br></div><div>Best</div><div>Wilfried</div><div><br></div><div></div></body></html>