我正在尝试创建内核密度估计 (KDE) 来估计多对长尾山雀的家庭范围。尽管过滤掉了少于五个 GPS 位置的对(“nest_id”变量),但在尝试为所有个人创建 kernelUD 时,我仍然收到错误消息“至少需要 5 次重新定位才能适应一个家庭范围”。我不确定到底是什么问题/我做错了什么。一般来说,我对家庭范围分析以及 R 和 adehabitatHR 非常陌生。下面是我的代码。
library(dplyr)
# reading in location data
locations <- read.csv("./data/GPS_LOCATIONS_MASTER.csv")
## making nest_id a factor
locations$nest_id <- as.factor(locations$nest_id)
## filtering for points I want to include
location_sub <- filter(locations, start_at_nest == "no")
## taking out pairs (via nest_id) with less than 5 GPS locations
xorig <- subset(location_sub,
with(location_sub,
nest_id %in% names(which(table(nest_id) >= 5))))
glimpse(xorig)
Observations: 257
Variables: 10
$ point_id <int> 293, 294, 299, 300, 303, 306, 307, 312, 315, 318, 324…
$ nest_id <fct> 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,…
$ female_id <fct> RPR, RPR, RPR, RPR, RPR, RPR, RPR, RPR, RPR, RPR, RPR…
$ male_id <fct> OWL, OWL, OWL, OWL, OWL, OWL, OWL, OWL, OWL, OWL, OWL…
$ lat <dbl> 53.38293, 53.38285, 53.38282, 53.38302, 53.38300, 53.…
$ lon <dbl> -1.554700, -1.554000, -1.553967, -1.554067, -1.553867…
$ start_at_nest <fct> no, no, no, no, no, no, no, no, no, no, no, no, no, n…
$ place_in_sequence <int> 3, 1, 3, 4, 3, 3, 4, 3, 3, 3, 3, 4, 5, 1, 2, 3, 4, 5,…
$ date_time <fct> 2019-02-27T13:26:31Z, 2019-02-27T13:28:46Z, 2019-02-2…
$ notes <fct> , , , , , , , , , , , , , , , , , , , , , , , , , ,
library(sp)
## projecting so that my x & y (in coords.x1 & coords.x2) are in metres
xorig_s <- SpatialPointsDataFrame(xorig,
coords = cbind(xorig$lon, xorig$lat),
proj4string = CRS("+proj=longlat +datum=WGS84 +no_defs"))
xorig_utm <- spTransform(xorig_s, CRS("+proj=utm +zone=30 +ellps=WGS84
+datum=WGS84 +units=m +no_defs"))
glimpse(as.data.frame(xorig_utm))
Observations: 257
Variables: 12
$ point_id <int> 293, 294, 299, 300, 303, 306, 307, 312, 315, 318, 324…
$ nest_id <fct> 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,…
$ female_id <fct> RPR, RPR, RPR, RPR, RPR, RPR, RPR, RPR, RPR, RPR, RPR…
$ male_id <fct> OWL, OWL, OWL, OWL, OWL, OWL, OWL, OWL, OWL, OWL, OWL…
$ lat <dbl> 53.38293, 53.38285, 53.38282, 53.38302, 53.38300, 53.…
$ lon <dbl> -1.554700, -1.554000, -1.553967, -1.554067, -1.553867…
$ start_at_nest <fct> no, no, no, no, no, no, no, no, no, no, no, no, no, n…
$ place_in_sequence <int> 3, 1, 3, 4, 3, 3, 4, 3, 3, 3, 3, 4, 5, 1, 2, 3, 4, 5,…
$ date_time <fct> 2019-02-27T13:26:31Z, 2019-02-27T13:28:46Z, 2019-02-2…
$ notes <fct> , , , , , , , , , , , , , , , , , , , , , , , , , ,
$ coords.x1 <dbl> 596131.3, 596178.1, 596180.4, 596173.3, 596186.6, 596…
$ coords.x2 <dbl> 5915843, 5915835, 5915831, 5915853, 5915852, 5915848,…
library(adehabitatHR)
## trying to create :
kud <- kernelUD(xorig_utm[,1], h = "href")
## this procures the error message:
Error in kernelUD(xorig_utm[, 1], h = "href") :
At least 5 relocations are required to fit an home range