How to use threshold values to reclassify as binary raster

3,116 views
Skip to first unread message

David Beasley

unread,
Aug 12, 2015, 7:56:18 AM8/12/15
to Maxent
Greetings,

Would someone be willing to explain how to use the threshold values in maxentResults.csv to classify the average raster generated by maxent? I am trying to follow along with the tutorial A_Maxent_Model_v7.pdf, but it is not clear to me how to use the values. 

For example, the raster (species_avg.asc) has values from Low : 0.000183701 - High : 0.797511
The 10 percentile training presence logistic threshold from maxentResults.csv is 0.404.

With the threshold of 0.404 I would like to make a binary map of habitat suitability with 0 representing unsuitable and 1 representing suitable habitat. Given the numbers above, would it be correct to reclassify the raster with  0.000183701 - 0.404 as 0 and 0.404 - 0.797511 as 1?

Thank you in advance,
David

Lawrence, Kevin

unread,
Aug 12, 2015, 4:46:45 PM8/12/15
to max...@googlegroups.com

David,

I would do the following using R

 library(raster)

 

species <- raster("species_avg.asc ")

##convert rasters to binary

## species> 0.404

 

rc <- function(x) {

ifelse(x <=  0.404, 0,

ifelse(x >  0.404, 1, NA)) }

speciesbin <- calc(species, fun=rc)

plot(speciesbin)

 

Hope it works,

Kevin

--
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+un...@googlegroups.com.
To post to this group, send email to max...@googlegroups.com.
Visit this group at http://groups.google.com/group/maxent.
For more options, visit https://groups.google.com/d/optout.

Madan K. Suwal

unread,
Apr 6, 2016, 3:19:05 PM4/6/16
to Maxent
Hi, I do it in ArcGIS by raster classification.
if there are only few files to, that is easier 

Jamie M. Kass

unread,
Apr 14, 2016, 12:29:43 PM4/14/16
to Maxent
Yes, this can also be done using the Con tool in ArcGIS. Set the conditional expression equal to what you want the output raster to represent: e.g. "VALUE > 0.6", and set the "true" raster to the original, where the "false" raster is 0. This is an easy way to get a binary raster from a continuous one.

Jamie Kass
PhD Student
City College of NY

Steve Research

unread,
May 11, 2016, 7:31:56 PM5/11/16
to Maxent
Thanks Kevin,

The R code works a treat. I added:

    writeRaster(speciesbin,"threshold.tif")

at the end which gives ma a nice raster to use in Qgis and another subsequent process that I then need to do on this (cutting it to a remnant vegitation shapefile).

Cheers,
Steve

Stênio Foerster

unread,
Aug 3, 2020, 6:35:38 PM8/3/20
to Maxent
Dear users, 

I think it is a quite simple (or even logic) question, but I really want to hear some directions about how to use thresholds for generate binary maps. 

The function evaluate from dismo package returns the desirable threshold to convert continuous maps to binary ones (e.g. max TPR+TNR). The question is, if we’re working with different scenarios, and thus different set of predictors (current, LGM and LIG), do we need to generate a different threshold for each predictor set and then create the binary maps, or should we use a single threshold (current) to generate binary maps for both scenarios? 

Let’s consider…

> dismo::evaluate(p = occ, a = abs, model = maxent_model, x = current_set)
> max TPR+TNR at : 0.3737239

> dismo::evaluate(p = occ, a = abs, model = maxent_model, x = lgm_set)
> max TPR+TNR at : 0.1209057

Which threshold should I use to generate a binary map for LGM time (0.37 or 0.12)?

Thanks in advance!  

Bede-Fazekas Ákos

unread,
Aug 4, 2020, 12:41:23 AM8/4/20
to max...@googlegroups.com
Dear Stênio,
I'm sure that only the threshold calculated from the current set has any meaning, since you have observations from the current (reference) period. There is absolutely no sense to "evaluate" the LGM if you have no observations from the LGM. Therefore, the threshold calculated from the current set should be used as binarization threshold for any other periodsa s well.
HTH,
Ákos Bede-Fazekas
Hungarian Academy of Sciences
--
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+un...@googlegroups.com.

Pritam Chhetri

unread,
Sep 23, 2021, 5:52:57 AM9/23/21
to Maxent
Hi Jamie,
I couldn't use that expression in Arc GIS , Will you please help me with and example.

Belay Ejigu

unread,
Sep 26, 2021, 3:30:00 AM9/26/21
to max...@googlegroups.com
Dear all, 

pls who can help me to understand how maxent model calculate the probability of similarity between the environmental variables at each grid cell and those of modelled species at presence points?.


Another if the maxent model uses gibbs propability formula, what the logistic output do?


When the formula f1x/L1 and fx/L used by maxent model?

--
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+un...@googlegroups.com.

Jamie M. Kass

unread,
Sep 26, 2021, 4:26:48 AM9/26/21
to Maxent
If you can't use that expression, it means you don't have the Spatial Analyst extension or you need to turn it on. Without it, you can't really work with rasters in ArcGIS. However, you can use the R code in this thread to do the same thing, for free. You can also use the free software QGIS -- just google "threshold raster" and I'm sure you can find a few tutorials.

Jamie M. Kass

unread,
Sep 26, 2021, 4:31:25 AM9/26/21
to Maxent
In response to https://groups.google.com/g/maxent/c/-YlmmhyMw4M/m/kcux_QjJBAAJ
Please start a new thread to ask this question, because it's not related to this thread.
Reply all
Reply to author
Forward
0 new messages