如何在 spatstat 中制作类似于 murchison 数据的数据集以进行 ppm 和 AUc 分析

How to make a dataset similar to that of murchison data in spatstat for ppm and AUc analysis

  1. 我有四个变量:a点进程模式种 产状、河流、池塘多边形和陆地图像数据。我想要 使用这些制作类似于 Murchison 数据集的数据集 形状层,但我没有操作。

    我需要从这些多边形图层制作数据框 河流、池塘和土地覆盖图像以及点模式 物种出现的数据我尝试使用超框架,但我 无法使用河流或池塘的距离函数。

    河流 <- readShapespatial("river.shp") 池塘 <- readShapeSpatial(pond.shp") 从 <- read.table("fro.txt", header=TRUE)图像<-光栅("image.tif")

    我要合并 这四个文件作为一个单独的 spatstat 对象,就像 Murchison 的那样 spatstat 包附带的数据。如果我能把它们放在相框里 那么池塘、土地覆盖、河流是协变量。

    我使用了分析函数,但是 return 错误,他们不能 用作协变量,例如 x 是一个列表,不能用作 当我调用 dist 时,尤其是池塘和河流的协变量 函数.

为什么需要 hyperframe?你指的是 murchison 数据,那不是 一个hyperframe。它只是一个标准的 R list(带有扩展 类 listofanylistsolist 以便更好地打印和绘图 spatstat,但实际的数据结构只是一个普通的 list).

重新创建 murchison 数据:

library(spatstat)
P <- murchison$gold # Points
L <- murchison$faults # Lines
W <- murchison$greenstone # "Windows

mur <- solist(points = P, lines = L, windows = W)
mur
#> List of spatial objects
#> 
#> points:
#> Planar point pattern: 255 points
#> window: rectangle = [352782.9, 682589.6] x [6699742, 7101484] metres
#> 
#> lines:
#> planar line segment pattern: 3252 line segments
#> window: rectangle = [352782.9, 682589.6] x [6699742, 7101484] metres
#> 
#> windows:
#> window: polygonal boundary
#> enclosing rectangle: [352782.9, 681699.6] x [6706467, 7100804] metres

要在模型中使用数据,不必将它们收集在一个列表中, 但它可能很方便。以下两个型号相同:

(mod1 <- ppm(P ~ W))
#> Nonstationary Poisson process
#> 
#> Log intensity:  ~W
#> 
#> Fitted trend coefficients:
#> (Intercept)       WTRUE 
#>  -21.918688    3.980409 
#> 
#>               Estimate      S.E.   CI95.lo    CI95.hi Ztest       Zval
#> (Intercept) -21.918688 0.1666667 -22.24535 -21.592028   *** -131.51213
#> WTRUE         3.980409 0.1798443   3.62792   4.332897   ***   22.13252
(mod2 <- ppm(points ~ windows, data = mur))
#> Nonstationary Poisson process
#> 
#> Log intensity:  ~windows
#> 
#> Fitted trend coefficients:
#> (Intercept) windowsTRUE 
#>  -21.918688    3.980409 
#> 
#>               Estimate      S.E.   CI95.lo    CI95.hi Ztest       Zval
#> (Intercept) -21.918688 0.1666667 -22.24535 -21.592028   *** -131.51213
#> windowsTRUE   3.980409 0.1798443   3.62792   4.332897   ***   22.13252

如果你坚持 hyperframe 你应该为每个测量值都有一列 变量,但这些主要用于有多个复制的情况 一个实验,在这里用处不大。函数调用很简单:

murhyp <- hyperframe(points = P, lines = L, windows = W)