Model Evaluation with Maxent in R

581 views
Skip to first unread message

Heiko

unread,
Nov 3, 2017, 10:02:10 AM11/3/17
to Maxent
Hey guys,

I have to evaluate the performance of a Maxent model.

My first idea was to (according to the Maxent help) just leave out the usual 20% of the data, train the model with the 80% and then in the end go with
e <- evaluate(Maxentmodell, p=occtest, a=bg, x=predictors)
e then gives me the AUC.

But in the java software it is very easy to do a repeated cross-validation and I think this is a more robust thing to do.
But I am struggling to do it in R. What am I doing wrong???

So I have my presence points as two columns long/lat called "occs".
This is my code:

k=5
group <- kfold(occs, k)
e <- list()
for (i in 1:k) {
  +         train <- occs[group != i,]
  +         test <- occs[group == i,]
  +         me <- maxent(predictors, train, nbg=10000, factors='ecoreg', path=paste("D:/maxent/tutorial-data/outputs/Dismo2",sep=""),
                         args=c('responsecurves=true','jackknife=true', "noaddsamplestobackground","noremoveduplicates"), progress='text')
  +         e[[i]] <- evaluate(p=test, a=back, me)
  + }


But R doesnt understand the for loop and gives me a red cross at the last "}" that ends the loop.


Any suggestion is highly welcome!!

Thank you,
Heiko

Heiko

unread,
Dec 20, 2017, 5:16:17 AM12/20/17
to Maxent
This problem is still ongoing.

No comments from the statistically more advanced people?
Whats the best way to go here and what is wrong with my code?

Thank you!!!

Alaaeldin Soultan

unread,
Dec 20, 2017, 7:58:37 AM12/20/17
to max...@googlegroups.com
Can you take ", progress='text'" out from your code and run it again

--
You received this message because you are subscribed to the Google Groups "Maxent" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maxent+unsubscribe@googlegroups.com.
To post to this group, send email to max...@googlegroups.com.
Visit this group at https://groups.google.com/group/maxent.
For more options, visit https://groups.google.com/d/optout.



--
Alaaeldin Soultan
PhD researcher
MaxPlanck Institute for Ornithology
Am Obstberg 1
78315 Radolfzell, Germany
Tel: +49 (0)7732 1501 911
Mob.+4915757474779




Ahmed El-Gabbas

unread,
Dec 20, 2017, 8:53:07 AM12/20/17
to Maxent
Hello,

This can be also because of the use of single and double quotations interchangeably in the same command. using either of them may solve the problem.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ahmed El-Gabbas,
PhD candidate, Department of Biometry and Environmental System Analysis, University of Freiburg
website: https://elgabbas.github.io

Jamie M. Kass

unread,
Dec 20, 2017, 9:27:14 AM12/20/17
to Maxent
Please check out the ENMeval package in R. You can use it to do a random k-fold cross validation and have it spit out the evaluation results in one line of code. You can rven have it explore different parameter settings (feature classes and reg multipliers). There’s even a vignette.

Jamie Kass
PhD Candidate
City College of NY
Reply all
Reply to author
Forward
0 new messages