[Biomod-commits] overlay response curve plot

Anne-Laure Monbertrand annelaure.monbertrand at gmail.com
Tue Jul 3 15:27:07 CEST 2012


Thanks Nicolas,

but it seems that the response.plot function is not recognized in the new
Biomod. I'm sorry I'm a bit confused but I don't really understand if
response curves are produced in the new Biomod

thanks

Anne-Laure

2012/7/3 Nico Davin <nicolasdavin at hotmail.com>

>  Dear Anne-Laure,
>
>
> Normally you use the function
> >response.plot()
>
> 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.
>
> For the importance of each variable, I don't know.
>
> Please find bellow the forwarded mail from Wilfred.
>
> I hope this help,
> Nico
>
>
>
>
> *Nicolas Davin *
>
> PhD. student
> [image: Description: Description: Logo ncb_naturalis_klein_72dpi]**
>
> *t* +31-71527-3570
> Netherlands Centre for Biodiversity Naturalis,
> P.O. Box 9514, 2300 RA Leiden, The Netherlands
> visiting address: Einsteinweg 2, Room C120
> www.ncbnaturalis.nl<https://vstpst.leidenuniv.nl/exchweb/bin/redir.asp?URL=http://www.ncbnaturalis.nl/>
>
> ------------------------------
> From: wilfried.thuiller at ujf-grenoble.fr
> Date: Wed, 7 Mar 2012 08:48:28 +0100
> To: emilie.roy-dufresne at mail.mcgill.ca
> CC: biomod-commits at r-forge.wu-wien.ac.at
> Subject: Re: [Biomod-commits] overlay response curve plot
>
> Dear Emilie, dear all,
>
> I have patched the response curve function to overlay the response curves
> for all selected models.
> This is really cool actually! The results are quite nice.
> Please find attached the new function. Once BIOMOD is loaded, source this
> one.
>
> source("PATH/response.plot.R")
>
> Compared to the former function, there is one argument more:
> plot=TRUE/FALSE
> If you put plot=TRUE, this is the same than the former one
> If you put plot=FALSE, a 3-D array object is returned. This 3-D array
> contains:
>
> First dimension: the same number of rows than the original data
> Second dimension: 2 columns: The first one is the explanatory variable to
> plot, the second one, the probability of occurrence to plot
> Third dimension: The set of environmental variables for which the
> response.plot was asked to run.
>
> I have tried with the following code:
>
> ### Only three models are selected (GLM, FDA and RandomForest)
> Initial.State(Response=Sp.Env[,12:13], Explanatory=Sp.Env[,4:10])
> Models(GLM = TRUE, TypeGLM = "quad", Test = "AIC", FDA = TRUE, RF = TRUE,
> NbRunEval = 0, Roc=T)
>
> ### Load back all models for the first species.
> LoadModels(Sp=1, PA='all', rep=1, models='all')
>
> ### Save the object return by the new response.plot function
> GLM.RC <- response.plot(Sp290_GLM_full, Sp.Env[,4:10], plot=F)
> FDA.RC <- response.plot(Sp290_FDA_full, Sp.Env[,4:10], plot=F)
> RF.RC <- response.plot(Sp290_RF_full, Sp.Env[,4:10], plot=F)
>
> ### plot the response for GLM for the first variable (the 1 for the third
> dimension)
> plot(GLM.RC[,1,1], GLM.RC[,2,1],  type="l", ylim=c(0,1), xlab=colnames(
> GLM.RC[,1,])[1], ylab="Probability of occurrence")
> ### then add the lines for the two other models with different colors
> lines(FDA.RC[,1,1], FDA.RC[,2,1], col='blue')
> lines(RF.RC[,1,1], RF.RC[,2,1], col='red')
> ### load the gplots package to make nice and user-friendly legends.
> library(plots)
> ### add a legend
> smartlegend(x="left",y="top", inset = 0, c("GLM", "FDA", "RF"), fill = c(
> "black", "blue", "red"))
>
>
> #### the same but with all variables plotted in the same plot window.
> library(gplots)
> par(mfrow=c(3,3))
> for(i in 1:ncol(Sp.Env[,4:10])){
>
>
> plot(GLM.RC[,1,i], GLM.RC[,2,i],  type="l", ylim=c(0,1), xlab=colnames(
> GLM.RC[,1,])[i], ylab="Probability of occurrence")
> lines(FDA.RC[,1,i], FDA.RC[,2,i], col='blue')
> lines(RF.RC[,1,i], RF.RC[,2,i], col='red')
> smartlegend(x="left",y="top", inset = 0, c("GLM", "FDA", "RF"), fill = c(
> "black", "blue", "red"),cex=0.6)
>
>
>
>
> }
>
>
> 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! ;-)
>
> Best
> Wilfried
>
>
>
> _______________________________________________ Biomod-commits mailing
> list Biomod-commits at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/biomod-commits/attachments/20120703/b3f068c8/attachment.html>


More information about the Biomod-commits mailing list