将MaxENT Project模型拟合到地理空间中

问题描述 投票:0回答:1

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

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

这里是栅格文件的属性

> 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中使用单引号,但问题仍然存在。

> 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'))
r rjava maxent
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.