这是随机几何中的一个经典问题。空间中完全随机的点,其中落在不相交区域中的点的数量彼此独立,对应于齐次泊松点过程(在本例中为 R^2,但可以在几乎任何空间中)。
一个重要的特征是,在独立于不相交区域中的点计数之前,点的总数必须是随机的。
对于泊松过程,点可以任意靠近。如果您通过对泊松过程进行采样来定义过程,直到没有任何距离太近的点为止,那么您就得到了所谓的吉布斯硬核过程。文献对此进行了大量研究,并且有不同的方法来模拟它。 R 包spatstat
有函数可以做到这一点。rHardcore
是一个完美的采样器,但是如果你想要高强度的点和大的硬核距离,它可能不会在有限的时间内终止......分布可以作为马尔可夫链的极限来获得rmh.default
让您可以使用给定的吉布斯模型作为其不变分布来运行马尔可夫链。这在有限的时间内完成,但只给出了近似分布的实现。
In rmh.default
您还可以在固定数量的点上进行条件模拟。请注意,当您在有限盒子中采样时,给定硬核半径可以拟合的点数量当然存在上限,并且越接近此限制,从分布中正确采样就越成问题。
Example:
library(spatstat)
beta <- 100; R = 0.1
win <- square(1) # Unit square for simulation
X1 <- rHardcore(beta, R, W = win) # Exact sampling -- beware it may run forever for some par.!
plot(X1, main = paste("Exact sim. of hardcore model; beta =", beta, "and R =", R))
minnndist(X1) # Observed min. nearest neighbour dist.
#> [1] 0.102402
近似模拟
model <- rmhmodel(cif="hardcore", par = list(beta=beta, hc=R), w = win)
X2 <- rmh(model)
#> Checking arguments..determining simulation windows...Starting simulation.
#> Initial state...Ready to simulate. Generating proposal points...Running Metropolis-Hastings.
plot(X2, main = paste("Approx. sim. of hardcore model; beta =", beta, "and R =", R))
minnndist(X2) # Observed min. nearest neighbour dist.
#> [1] 0.1005433
点数的近似模拟
X3 <- rmh(model, control = rmhcontrol(p=1), start = list(n.start = 42))
#> Checking arguments..determining simulation windows...Starting simulation.
#> Initial state...Ready to simulate. Generating proposal points...Running Metropolis-Hastings.
plot(X3, main = paste("Approx. sim. given n =", 42))
minnndist(X3) # Observed min. nearest neighbour dist.
#> [1] 0.1018068