GLM returning negative value for threshold (cut-off)(in R)

441 views Asked by At

I am working with species distribution modeling with GLM. I have (South America) data for Caiman crocodilus species from GBIF (http://www.gbif.org/species/5846514) and bioclimatic data from Worldclim (http://worldclim.org/current). I trying to run GLM in order to model species distribution (with dismo package):

modelGLM = pres ~ bioclim_10 + bioclim_11+ bioclim_16 + I(bioclim_16^2) + bioclim_17
GLM <- glm(modelGLM, family=binomial(link=logit), data=PresBackTrainRaw)
projecaoSuitability = predict(predictors, GLM, type='response')

Until here, everything looks fine, but when I try to obtain the threshold (cut-off), negative value is returning:

library(dismo)
> evaluation=evaluate(p=presencesTest,a=backgroundTest,m=GLM,x=predictors)
> thresholdValues=threshold(evaluation,'spec_sens')  
> thresholdValues    
> [1] -2.578797

Since glm output (with type='response') ranges from 0 to 1, a negative threshold does not make sense. Someone can help me see what is wrong?

1

There are 1 answers

0
user3369932 On BEST ANSWER

Solution (provided by user20650):

Add type='response' in evaluate:

library(dismo) evaluation=evaluate(p=presencesTest,a=backgroundTest,m=GLM,x=predictors,type='response') thresholdValues=threshold(evaluation,'spec_sens')
thresholdValues
[1] 0.07042211