首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MaxENT工程向地理空间拟合模型

MaxENT工程向地理空间拟合模型
EN

Stack Overflow用户
提问于 2020-02-03 05:25:45
回答 1查看 150关注 0票数 0

here回答了类似的问题;但是,这个问题有点不同,我无法应用该解决方案。我已经安装了使用网站数据格式的maxent。问题是我无法预测合适的模型。m1在路径D:/maxent中的输出看起来很好。我怀疑这两个错误(下面)与rJava有关,但我不知道解决方案。请参阅我的代码如下:

代码语言:javascript
复制
> m1 <- maxent(x = d, p = id, path = "D:/maxent", 
             args = c("-P", "noautofeature", "nolinear", "noquadratic", "nothreshold", 
                      "noproduct", "betamultiplier=1", "replicates=10", "crossvalidate"))

# here d is a dataframe containing 11213 rows and 20 predictor columns (with numeric values), id is a vector containing numeric values of 1 and 0 (representing species presence and absence)
Loading required namespace: rJava
> plot(m1, xlim=c(0,100))
Error in as.double(y) : 
  cannot coerce type 'S4' to vector of type 'double'

> ras <- raster("E:/bio12.tif") # raster to project the fitted model 'm1'

> pred.m1 <- raster::predict(m1, ras)
Error in .local(object, ...) : missing layers (or wrong names)

以下是光栅文件的属性

代码语言:javascript
复制
> ras
class       : RasterLayer 
dimensions  : 4292, 4936, 21185312  (nrow, ncol, ncell)
resolution  : 0.008333333, 0.008333333  (x, y)
extent      : 112.8917, 154.025, -43.75833, -7.991667  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
data source : E:/Predictors_grasshoppers/selected.predictors/bio12.tif 
names       : bio12 
values      : 79, 7625  (min, max)

更新:我尝试在m1中使用单引号,问题仍然存在。

代码语言:javascript
复制
> m2 <- maxent(x = d, p = id, path = 'D:/PhD related/Historic climate data Australia/maxent2', 
             args = c('-P', 'noautofeature', 'nolinear', 'noquadratic', 'nothreshold', 
                      'noproduct', 'betamultiplier=1', 'replicates=10', 'crossvalidate'))
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-09 23:24:47

在@Bappa的评论之后,我找到了解决方案。要将最大拟合模型投影到地理空间,应该使用包含模型拟合过程中使用的变量的栅格堆栈(而不是单个栅格)。光栅堆栈中预测器的顺序和名称应与拟合模型中的预测器相同。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60033523

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档