1

I was wondering if there's a built-in function to extrapolate a point pattern outside the 'parent' window in R. For instance, let's generate a spatial point pattern 'X':

require(spatstat)
X <- ppp(runif(200), runif(200), 
c(0,1), c(0,1), unitname=c("metre","metre"))

Let's resample the data:

a <- quadratresample(X, nx=25, ny=5, replace=F, nsamples = 1)

But the the new points are generated within the same area/spatial window

> a
 planar point pattern: 200 points 
window: rectangle = [0, 1] x [0, 1] metres  

My question is: how would I resample the 200 points within a new window bigger than the original window (1 by 1 m); in other words, how would I extrapolate the small set of 200 spatial points to a larger scale while keeping the same resampling density; say I want to see a total of 1,000 data points in a 5 by 5 m extent?

4

1 回答 1

2

这很容易,因为spatstat为我们提供了所有正确的工具。您当前有一个 1x1 网格。您需要一个由 25 个 1x1 网格构成的 5x5 网格。我们可以使用参数对这些网格的点进行采样nsamples

a <- quadratresample(X, nx = 25, ny = 5, replace = F, nsamples = 25)

现在我们有一个 25ppp秒的列表。正如您所指出的,所有这些都将在同一个 1x1 窗口中。为了把它们变成一个网格,我们适当地移动它们,从 x 偏移 0 到 4 个单位,在 y 偏移中从 0 到 4 个单位:

for (i in seq_along(a)) {
    a[[i]] = shift(a[[i]], vec = c((i - 1) %% 5, (i - 1) %/% 5))
}

要组合它们,请使用superimpose

b = superimpose(a)

这会ppp在 5x5 窗口中提供一个具有 200 * 25 = 5000 个点的对象,这会保留原始的每单位平方 200 个点。

于 2015-09-17T07:04:30.293 回答