如何用R模拟任意区域的空间泊松过程?

时间:2013-06-27 04:21:03

标签: r simulation geospatial spatial poisson

我正在研究R 3.0.1我做了聚集泊松过程的模拟,R通常有一个默认区域,基本上是一个盒子,在下一张图片中你可以看到我的仿真:

enter image description here

到目前为止,一切都很好,我想做的麻烦是模拟相同的distribution,但使用的是地理区域,但我不知道如何更改参数以便拥有使用地理坐标的不同区域。例如:

enter image description here

总而言之,基本上我想要做的是弄清楚如何为更大的区域改变这个区域,以便使用新区域进行相同的模拟。这是我试过的代码:

library(spatstat)

sim1 = rpoispp(100)
plot(sim1)

1 个答案:

答案 0 :(得分:6)

你可以试试这个:

require(spatstat)
require(maps)

lambda = 0.1 # intensity of the process
lon = c(-100,-70) # domain's longitude
lat = c(-40,10)   # domain's latitude

sim = rpoispp(lambda, win=c(lon,lat))

# do the plot
par(mar=c(1,1,1,1))
map("world", xlim=lon, ylim=lat, fill=TRUE)
map.axes() # add axes
plot(sim, chars=19, cols="red",cex=0.5, add=TRUE)

# add other process

lon1 = c(-95,-85) # other area
lat1 = c(-5,5)
sim1 = rpoispp(5*lambda, win=c(lon1,lat1))
plot(sim1, chars=19, cols="blue",cex=0.5, add=TRUE)

Final map

相关问题