data(puechabon)
loc <- puechabon$locs[, c("X", "Y")]
id <- puechabon$locs[, "Name"]
## Estimation of UD for the four animals
ud <- kernelUD(loc, id)
ud
image(ud) ## Note that the contours
## corresponds to values of probability density
udvol <- getvolumeUD(ud)
image(udvol)
## Here, the contour corresponds to the
## home ranges estimated at different probability
## levels (i.e. the contour 90 corresponds to the 90 percent
## kernel home-range)
## udvol describes, for each cell of the grid,
## the smaller home-range to which it belongs
## Calculation of the 95 percent home range
ver <- getverticeshr(ud, 95)
elev <- getkasc(puechabon$kasc, "Elevation") # Map of the area
image(elev)
for (i in 1:length(ver))
lapply(split(ver[[i]][,2:3],ver[[i]][,1]),
function(x) polygon(x, col = i+1))
legend(696500, 3166000, legend = names(ver), fill = 2:5)
## Example of estimation using LSCV
udbis <- kernelUD(loc, id, h = "LSCV")
image(udbis)
## Compare the estimation with ad hoc and LSCV method
## for the smoothing parameter
(cuicui1 <- kernel.area(loc, id)) ## ad hoc
plot(cuicui1)
(cuicui2 <- kernel.area(loc, id, h = "LSCV")) ## LSCV
plot(cuicui2)
## Diagnostic of the cross-validation
plotLSCV(udbis)
## Use of the same4all argument: the same grid
## is used for all animals
udbis <- kernelUD(loc, id, same4all = TRUE)
image(udbis)
## And finally, estimation of the UD on a map
## (e.g. for subsequent analyses on habitat selection)
elev <- getkasc(puechabon$kasc, "Elevation")
opar <- par(mfrow = c(2, 2), mar = c(0, 0, 2, 0))
cont <- getcontour(elev)
for (i in 1:length(udbis)) {
image(elev, main = names(udbis)[i], axes = FALSE)
points(udbis[[i]]$locs, pch = 21, bg = "white", col = "black")
}
## Measures the UD in each pixel of the map
udbis <- kernelUD(loc, id, grid = elev)
opar <- par(mfrow = c(2, 2), mar = c(0, 0, 2, 0))
for (i in 1:length(udbis)) {
image(udbis[[i]]$UD, main = names(udbis)[i], axes = FALSE)
box()
polygon(cont[, 2:3])
}
par(opar)
Run the code above in your browser using DataLab