【问题标题】:GLM returning negative value for threshold (cut-off)(in R)GLM 返回阈值的负值(截止)(在 R 中)
【发布时间】:2016-12-21 23:05:18
【问题描述】:

我正在使用 GLM 进行物种分布建模。我有来自 GBIF (http://www.gbif.org/species/5846514) 的 凯门鳄 物种的(南美洲)数据和来自 Worldclim (http://worldclim.org/current) 的生物气候数据。我试图运行 GLM 以模拟物种分布(使用 dismo 包):

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

直到这里,一切看起来都很好,但是当我尝试获取阈值(截止)时,返回负值:

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

由于 glm 输出(type='response')的范围是 0 到 1,负阈值没有意义。有人可以帮我看看有什么问题吗?

【问题讨论】:

  • 您是否 100% 确定此计算是在概率尺度而非 logit/log-odds 尺度上进行的?
  • 来自 ?evaluate : evaluate 似乎有一个 ... 参数用于 predict 。尝试添加type='response'
  • 是的!这提供了正确的阈值。非常感谢!

标签: r glm dismo


【解决方案1】:

解决方案(user20650提供):

evaluate中添加type='response'

库(dismo) 评估=评估(p=presencesTest,a=backgroundTest,m=GLM,x=predictors,type='response') 阈值=阈值(评估,'spec_sens')
阈值
[1] 0.07042211

【讨论】:

    猜你喜欢
    • 2014-06-08
    • 1970-01-01
    • 2020-10-07
    • 2019-04-06
    • 1970-01-01
    • 2014-10-23
    • 2021-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多