尝试使用 spatstat 生成具有协变量数据的 LGCP 时,函数 rLGCP 失败

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

我正在尝试基于协变量场的图像数组和 GMRF 场的母协方差函数来模拟对数高斯 cox 过程,几乎完全基于“使用随机偏微分方程的高级空间建模”中给出的示例使用 R 和 INLA”(https://becarioprecario.bitbucket.io/spde-gitbook/ch-lcox.html)。然而,在线教科书中编写的代码在生成 LGCP 时会发出警告。

使用的代码在这里:

library(spatstat)

win <- owin(c(0, 3), c(0, 3))
npix <- 300
spatstat.options(npixel = npix)

beta0 <- 3
sigma2x <- 0.2
range <- 1.2
nu <- 1

set.seed(7)

x0 <- seq(0, 3, length=npix)
y0 <- seq(0, 3, length=npix)
gridcov <- outer(x0, y0, function(x,y) cos(x) - sin(y - 2))

beta1 <- 0
sum(exp(beta0 + beta1 * gridcov) * diff(x0[1:2]) * diff(y0[1:2]))

lg.s.c <- rLGCP('matern', im(beta0 + beta1 * gridcov, xcol = x0,
  yrow = y0), var = sigma2x, scale = range / sqrt(8), 
  nu = 1, win = win)
xy.c <- cbind(lg.s.c$x, lg.s.c$y)[, 2:1]
n.c <- nrow(xy.c)

Lam <- attr(lg.s.c, 'Lambda')
rf.s.c <- log(Lam$v)


返回的警告为

the images ‘e1’ and ‘e2’ were not compatible 
,生成的强度场 rf.s.c 的尺寸为 562 x 562,而输入 x 和 y 数组为 1x100(强度场应为 100 x 100),并且完全是 NA 值。

有人可以帮助我理解这个警告以及为什么这个例子失败了吗?

r spatial spatstat
1个回答
0
投票

这很可能是

spatstat
中的一个错误。最近,由于 CRAN 上不再包含 RandomFields 包,因此添加了用于 LGCP 模拟的新代码。我们将进一步调查,您可以在 GitHub 上跟踪问题的状态: https://github.com/spatstat/spatstat.random/issues/2

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