Hi Chris,
Just to follow up on this, this is the approach I am taking to specify a common grid, although I still get the same error message about grids being inconsistent. I tried including/excluding the grid argument from the pkde function but nothing changes. Any thoughts?
I first estimated UDs for a single individual to use as a reference grid.
DATA <- as.telemetry(
data,
timeformat = "auto",
timezone = "UTC",
projection=
"+proj=merc +lon_0=0 +k=1 +datum=WGS84 +units=m +no_defs" ,
dt.hot = NA,
timeout = Inf,
na.rm = "row",
mark.rm = FALSE,
keep = FALSE,
drop = TRUE
)
grid_ref_tele <- DATA[[5]]
guess <- ctmm.guess(grid_ref_tele, interactive = FALSE)
FITS <- ctmm.select(grid_ref_tele, guess)
dt <- 5 %#% 'min'
GRID_REF_UD <- akde(grid_ref_tele,FITS,dt=dt, weights=FALSE,trace=TRUE) # make individual UD to use as grid reference
I then run the following loop which produces UDs from several individuals for several years and stores the PKDEs in a list (I've removed some of the code for clarity)
for(species_s in species_list){
# Filter by species
species_filter <- all_states_filtered %>% filter(species == species_s)
for(year_y in unique(species_filter$Year)){
# Filter by year
year_filter <- species_filter %>% filter(Year == year_y)
# Convert to telemetry objects (one per individual)
DATA <- as.telemetry(
year_filter,
timeformat = "auto",
projection=
"+proj=merc +lon_0=0 +k=1 +datum=WGS84 +units=m +no_defs" ,
timezone = "UTC",
dt.hot = NA,
timeout = Inf,
na.rm = "row",
mark.rm = FALSE,
keep = FALSE,
drop = TRUE
)
# ===========================
# FIT INDIVIDUAL MODELS USING lapply
# ===========================
FITS <- lapply(DATA, function(x){
guess <- ctmm.guess(x, interactive = FALSE)
ctmm.select(x, guess)
})
dt <- 5 %#% 'min' # from dt.plot
UDS <- akde(DATA,FITS,weights=FALSE, dt = dt,trace=TRUE, grid=GRID_REF_UD) # make individual IDs, takes c. 30 mins/year/species
PKDE <- pkde(DATA, UDS, kernel="individual", grid=GRID_REF_UD, weights = FALSE) # make population UDs
all_PKDE_list <- c(all_PKDE_list, list(PKDE)) #save PKDEs in list
}
}
all_PKDEs_overlaps_95 <- overlap(all_PKDE_list, method="Bhattacharyya", level=0.95, debias=T)
Error in grid.intersection(UD) : Inconsistent grid resolutions.
Thanks!
Sam