spatstat 中 adaptive.density 函数的输出

Output of adaptive.density function in spatstat

我正在阅读 "Spatial Point Patterns: Methodology and Applications with R" 这本书的第 6 章,试图复制 companion website 中代码之后的所有示例。我无法复制图 6.15 (a),因为这是我得到的输出,它与书中的图大不相同。

library(spatstat)
#> Carico il pacchetto richiesto: spatstat.data
#> Carico il pacchetto richiesto: nlme
#> Carico il pacchetto richiesto: rpart
#> 
#> spatstat 1.60-1       (nickname: 'Swinging Sixties') 
#> For an introduction to spatstat, type 'beginner'

swp <- rescale(swedishpines)
aden <- adaptive.density(swp, f=0.1, nrep=30)
#> Computing 30 intensity estimates...
#> 
#>      PLEASE NOTE:  The components "delsgs" and "summary" of the
#>  object returned by deldir() are now DATA FRAMES rather than
#>  matrices (as they were prior to release 0.0-18).
#>  See help("deldir").
#>  
#>      PLEASE NOTE: The process that deldir() uses for determining
#>  duplicated points has changed from that used in version
#>  0.0-9 of this package (and previously). See help("deldir").
#> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,  30.
#> Done.
rainsat <- function(n) {
  grade <- sqrt(seq(0.1, 1, length=n))
  rainbow(n=n, start=1/2, s=grade)
}


par(mar = c(1, 0, 0, 2))
plot(aden, main="", ribscale=1000, col=rainsat)
plot(swp, add=TRUE, pch=3)

reprex package (v0.3.0)

于 2019-09-06 创建

这里有什么问题?我究竟做错了什么?即使我 运行 startup.Rfigurelayout.R 文件中的所有代码(它们应该只是更改制作 b/w 的图的列)我仍然无法获得相同的图.

adaptive.density涉及随机化。如果您重复相同的命令两次,您将不会得到相同的结果(除非您重置 random.seed)。 较大的 nrep 值将减少随机变化。