R中的HMSC软件包中的命令“ sampleMcmc”中出现错误消息

时间:2020-02-06 11:37:24

标签: r

在R中运行以下代码时,我收到并无法理解的错误消息

我有以下示例数据集的地块x物种丰富度

dput(fern[1:5,c(1,3:5)])

structure(c("plot1", "plot2", "plot3", "plot4", "plot5", " 1", 
" 7", " 8", " 10", " 0", "5", "3", "2", "1", "4", " 18", " 13", 
" 0", " 9", " 10"), .Dim = 5:4, .Dimnames = list(NULL, c("plot", 
"Actin_penn", "Actin_subt", "Adian_adia")))

和环境数据

dput(env2[1:5,-c(2)])

structure(c("plot1", "plot2", "plot3", "plot4", "plot5", "2902", 
"3047", "2797", "2752", "2832", "1303", "1355", "1252", "1230", 
"1272", "468", "488", "445", "444", "449", "2958", "2962", "3874", 
"3874", "3782", "127", "129", "145", "147", "148"), .Dim = 5:6, .Dimnames = list(
    NULL, c("plot", "Band4median15", "Band5median15", "Band7median15", 
    "Chelsa450bio12", "SRTM90")))

我首先运行模型

XData=as.data.frame(env2)
m = Hmsc(Y = fern,
         XData = XData,
         distr = "lognormal poisson")

并且看起来还可以,至少没有错误消息。

然后我尝试示例

thin = 1
samples = 500
nChains = 1
set.seed(1)
m = sampleMcmc(m, samples = samples, thin = thin,
               adaptNf = rep(ceiling(0.4*samples*thin),1),
               transient = ceiling(0.5*samples*thin),
               nChains = nChains, nParallel = nChains)

得到

Error in checkForRemoteErrors(val) : 
  4 nodes produced errors; first error: non-numeric argument to binary operator

关于什么是错的任何想法?

0 个答案:

没有答案