<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Dear Anne-Laure, <div><br></div><div><br></div><div>Normally you use the function </div><div><span style="font-size: 10pt; ">>response.plot()</span></div><div><br></div><div>I do not know if this would help; but few months ago Wilfred gave a code to plot the response curves and more especially overlay the response curve of all the model.</div><div><br></div><div>For the importance of each variable, I don't know.</div><div><br></div><div>Please find bellow the forwarded mail from Wilfred.</div><div><br></div><div>I hope this help,</div><div>Nico</div><div><br></div><div><br></div><div><br><br><p class="ecxMsoNormal" style="text-align:justify"><b><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)" lang="EN-GB">Nicolas Davin
</span></b></p>

<p class="ecxMsoNormal"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)" lang="EN-GB">PhD. student
<br>
</span><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)"><img id="ecxPicture_x0020_1" src="../att/GetInline.aspx?messageid=86baf4ea-1f34-11e1-8dbb-00215ad6a63e&attindex=0&cp=-1&attdepth=0&imgsrc=cid:image001.jpg%4001CCB0F8.DE953480&shared=1&hm__login=nicolasdavin&hm__domain=hotmail.com&ip=10.211.4.8&d=d5732&mf=0&hm__ts=Mon%2c%2005%20Dec%202011%2012:38:44%20GMT&st=nicolasdavin&hm__ha=01_c56b2dd7f08460df4865a84b0d37beb7f1522aff25993a1151340547a66aa132&oneredir=1" alt="Description: Description: Logo ncb_naturalis_klein_72dpi" height="14" width="101"></span><b><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)" lang="EN-GB"></span></b></p>

<p class="ecxMsoNormal"><b><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)" lang="EN-GB">t</span></b><span style="font-size:5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)" lang="EN-GB"> </span><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)" lang="EN-GB">+31-71527-3570</span></p>

<span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)" lang="EN-GB">Netherlands Centre for Biodiversity Naturalis,<br>
P.O. Box 9514, 2300 RA Leiden, The Netherlands<br>
visiting address: Einsteinweg 2, Room C120<br>
</span><span style="font-size:10pt;font-family:"Tahoma","sans-serif";color:black"><a href="https://vstpst.leidenuniv.nl/exchweb/bin/redir.asp?URL=http://www.ncbnaturalis.nl/" target="_blank"><span style="font-size:7.5pt;font-family:"Verdana","sans-serif";color:rgb(127, 127, 127)" lang="EN-GB">www.ncbnaturalis.nl</span></a></span><br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">From: wilfried.thuiller@ujf-grenoble.fr<br>Date: Wed, 7 Mar 2012 08:48:28 +0100<br>To: emilie.roy-dufresne@mail.mcgill.ca<br>CC: biomod-commits@r-forge.wu-wien.ac.at<br>Subject: Re: [Biomod-commits] overlay response curve plot<br><br><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-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-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-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 13px/normal Courier;min-height:16px"><br></div><div style="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-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-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 13px/normal Courier;min-height:16px"><br></div><div style="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-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-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-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-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 13px/normal Courier;min-height:16px"><br></div><div style="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-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-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-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-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-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-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-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-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-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 13px/normal Courier;min-height:16px"><br></div><div style="margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 13px/normal Courier;min-height:16px"><br></div><div style="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-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-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-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="font:13.0px Courier;min-height:16.0px"><span class="ecxApple-tab-span" style="white-space:pre">  </span><br class="ecxwebkit-block-placeholder"></p><div style="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="ecxApple-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-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="ecxApple-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-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="ecxApple-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-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="ecxApple-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-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 13px/normal Courier;min-height:16px"><br></div><div style="margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 13px/normal Courier;min-height:16px"><br></div><p style="font:13.0px Courier;min-height:16.0px"><span class="ecxApple-tab-span" style="white-space:pre">  </span><br class="ecxwebkit-block-placeholder"></p><p style="font:13.0px Courier;min-height:16.0px"><span class="ecxApple-tab-span" style="white-space:pre">      </span><br class="ecxwebkit-block-placeholder"></p><div style="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><br><div></div><br>_______________________________________________
Biomod-commits mailing list
Biomod-commits@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits</div></div>                                       </div></body>
</html>