时空中的随机点

极光芋头

我有一套日期堆肥由几年的死亡率在道路上。我的数据是坐标 x&y。我需要创建一个随机分布的数据作为对照,以便能够将我的数据与随机对照进行比较,并查看是否存在死亡率热点。我知道可以用 R 创建一组随机点,但我不知道如何使两者在时间上具有可比性。我怎样才能在几年内创造这些积分?

再次感谢你

极光

阿尔特姆

为了识别热点,最好使用2D 核密度估计请参阅下面来自华盛顿州数据门户的道路死亡死亡率示例使用contour图和kde2d函数来识别热点请看下面的代码:

library(lubridate)
mort <- read.csv("https://data.wa.gov/api/views/mcp7-tcwf/rows.csv?accessType=DOWNLOAD", stringsAsFactors = FALSE)

ll <- t(sapply(mort$Location, function(x) na.omit(as.numeric(unlist(strsplit(x, "\\(|\\,| |\\)"))))))
rownames(ll) <- NULL
colnames(ll) <- c("lat", "lon")
mort2 <- cbind(mort, ll)
mort2$Salvage.Date.Time2 <- mdy_hms(mort2$Salvage.Date.Time)
mort2$month <- month(mort2$Salvage.Date.Time2)
mort2$year <- year(mort2$Salvage.Date.Time2)
mort2 <- mort2[mort2$year> 2016, ]

mort3 <- mort2[with(mort2, lat > 45.5 & lat < 49.& lon > -125 & lon < -116), ]
f1 <- with(mort3, kde2d(lat, lon, n = 100))

plot(mort3$lat, mort3$lon, pch = 18, col = "lightblue")
contour(f1, levels  =  c(0.01, 0.05, 0.1, 0.2), add = TRUE, labcex = 1)

输出: 地块

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章