[Biomod-commits] Adding histogram (X=Expl.Var) to response curves

Wilfried Thuiller wilfried.thuiller at ujf-grenoble.fr
Fri May 18 15:01:02 CEST 2012

Dear Joseph,
Better to do it sequentially. There is the option to save the response curves (similar to the option in box plot, see ?response.plot). That way you can really play with the response curves

I have done it the BIOMOD data. Not easy to see anything nice. I would rather recommend the rug option instead of the histogram to show the density of points



#This command is necessary for the run of BIOMOD as a new dataframe is produced for the Models function
Initial.State(Response=Sp.Env[,12:13], Explanatory=Sp.Env[,4:10], 
IndependentResponse=NULL, IndependentExplanatory=NULL)

#Let's run only a few models : GLM, FDA and RF. This will take a few moments to run.
#Do note that the response.plot() function works for all the models available. Feel free to switch them on or off.
Models(GLM = TRUE, TypeGLM = "quad", Test = "AIC", FDA = TRUE, CV.tree = 50, RF = TRUE, CV.ann = 2, 
   NbRunEval = 0, DataSplit = 80, Roc=TRUE, Optimized.Threshold.Roc=TRUE, Kappa=TRUE, TSS=TRUE, VarImport=5,
   NbRepPA=0, strategy="sre", coor=NULL, distance=0, nb.absences=1000)

#The response plots for the first species modelled 
GLM.RC <- response.plot(Sp290_GLM_full, Sp.Env[,4:10], plot=F, save.file="yes")

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")

Hope it helps,

Le 18 mai 2012 à 12:38, Joseph Maina a écrit :

> Hi,
> I am trying to add histograms to response curves which were generated
> from a model using the 'response.plot' function. For each variable in
> Expl.Var, histograms should be plotted with the corresponding response
> curve. My script below adds a histogram only to the last response plot
> in the graph. I would appreciate any help with suggestions on how to
> add a histogram to the response plots, where x in the histogram is
> based on Expl.Var or the x-axis of the response curve.
> Thanks.
> response.plot(speciesA_GLM_full, Expl.Var, show.variables =
> seq(1:ncol(Expl.Var)))
> for(i in seq(1:ncol(Expl.Var){
>      hist((x=Expl.Var[,i]),add=TRUE,freq=FALSE)}

Dr. Wilfried Thuiller
Laboratoire d'Ecologie Alpine, UMR CNRS 5553
Université Joseph Fourier
BP53, 38041 Grenoble cedex 9, France
tel: +33 (0)4 76 51 44 97
fax: +33 (0)4 76 51 42 79

Email: wilfried.thuiller at ujf-grenoble.fr
Personal website: http://www.will.chez-alice.fr
Team website: http://www-leca.ujf-grenoble.fr/equipes/emabio.htm

ERC Starting Grant TEEMBIO project: http://www.will.chez-alice.fr/Research.html
FP6 European EcoChange project: http://www.ecochange-project.eu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/biomod-commits/attachments/20120518/8d77d2ac/attachment.html>

More information about the Biomod-commits mailing list