[Biomod-commits] MaxEnt and BIOMOD

Wilfried Thuiller wilfried.thuiller at ujf-grenoble.fr
Sat Apr 23 15:38:50 CEST 2011

Dear Charles,

> First of all, I must say that it is a great pleasure to read all the
> interesting discussions we have in this list, we learn a lot with
> every message! Thanks, and congratulations!!
> Well, sorry if the question I will point here has been done before,
> but I really didn't find anything about it in previous messages I
> have:
> Is it posible to include MaxEnt among the models simulated by BIOMOD?
> In my opinion, the great strength of BIOMOD, beyond many other
> benefits, is to allow the ensemble of many models in an easy way, and
> so to give us more confidence results of our simulations. But I see
> that MaxEnt is often used to simulate distribution of species and
> sometimes I ask myself why it is not included in BIOMOD (yet). Is it a
> "stupid" question? (I really believe that there are NO "stupid"
> questions, but... :-))

This is indeed a very interesting question. 
The answer is no and yes. 
No because Maxent is coded in Java, much more efficient than in R. We'll have to recode the entire program in C or C++ to fully integrate it in R and latter in BIOMOD. 

However, this is easy to run Maxent using a batch command from R. I have thought about putting Maxent within BIOMOD that way since a while. I am just to busy to do it but hope to start looking at that this year. 

For curious, find below a short code for running Maxent from R.
You need the ascii data for running it and modify all paths and data for your own data.
My species is Sp290.csv (Sp290 from SpEnv data in BIOMOD exported in csv format for Maxent).
The environmental variables are the same than SpEnv, as many ascii files as variables. 
You need maxent.jar in your working directory. 

dir.create(path=paste(getwd(), "/MaxEnt.res", sep=""))
MaxEnt.layers <- paste(getwd(), "/europe/ascii/current", sep="")
MaxEnt.out <- paste(getwd(), "/MaxEnt.res", sep="")
MaxEnt.samples <- paste(getwd(), "/europe/point", sep="")

layers <- list.files(MaxEnt.layers)

# run MaxEnt:
system(command=paste("java -jar maxent.jar environmentallayers=", MaxEnt.layers, " samplesfile=", MaxEnt.samples, "/Sp290.csv", " outputdirectory=", MaxEnt.out, "  maximumiterations=100 redoifexists autorun nowarnings notooltips", sep=""))

system(command=paste("java -mx4000m -jar maxent.jar environmentallayers=", MaxEnt.layers, " samplesfile=", MaxEnt.samples, "/Sp290.csv", " outputdirectory=", MaxEnt.out, " 'applythresholdrule=equal training sensitivity and specificity' maximumiterations=100 redoifexists autorun nowarnings notooltips", sep=""))


#Import the predictions on the presence points
Pred.Maxent.Sp290.sample <- read.csv(paste(getwd(), "/MaxEnt.res/Sp290_samplePredictions.csv", sep=""))

#Plot the results from Maxent
level.plot(Sp.Env$Sp290, XY=Sp.Env[,2:3], color.gradient = "grey", cex=0.3,show.scale=F, title="Original data")
level.plot(Pred.Maxent.Sp290.sample$Logistic.prediction, XY=Pred.Maxent.Sp290.sample[,1:2], color.gradient = "grey", cex=0.3,show.scale=F, title="Maxent")
points(Sp.Env[Sp.Env$Sp290<1,2], Sp.Env[Sp.Env$Sp290<1,3], cex=0.3, pch=2,col="grey93")

You see, this is not that difficult. I just need to see how to fully implement this in the existing structure of BIOMOD, the most difficult part obviously. 



> Thanks for the attention,
> Best regards,
> Charles
> -- 
> Um axé! :)
> --
> Charles Novaes de Santana
> PhD student - Global Change
> Laboratorio Internacional de Cambio Global
> Department of Global Change Research
> Instituto Mediterráneo de Estudios Avanzados(CSIC/UIB)
> Calle Miquel Marques 21, 07006
> Esporles - Islas Baleares - España
> _______________________________________________
> 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

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

FP6 European MACIS project: http://www.macis-project.net
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/20110423/48a8154b/attachment.htm>

More information about the Biomod-commits mailing list