## Can also be used to analyse a point pattern
## For example, locations of chamois in
## the Chartreuse mountains (French Alps)
data(chamois)
xy <- chamois$locs
## choice of the number of neighbors
## Warning: this command can be very long (more than two minutes)
u <- neighNNCH(xy, rangek = 5:30)
plot(u)
## 13 and 20 neighbours seem to be a good choice
## Estimates the home range levels
(aa <- NNCH(xy, k = 13))
plot(aa)
## plot of the home-range size
plot(NNCH.area(aa))
## gets the home range contour
cont <- getverticesNNCH(aa)
plot(cont)
## rasterizes these contours
sl <- getkasc(chamois$map, "Slope")
mm <- NNCH.rast(cont, sl)
image(mm)
## Note that two different sets of polygons can include
## the same percentage of relocation
aa[[1]]$area[97:105,]
## For example, the same percentage of relocations is
## included within the limits of the two home ranges
## (91.92 percent of the localisations)
opar <- par(mfrow=c(1,2))
plot(aa[[1]]$polygons[[103]],
poly.args = list(lwd = 2))
points(xy, pch = 16, cex = 0.5)
plot(aa[[1]]$polygons[[98]],
poly.args = list(lwd = 2))
points(xy, pch=16, cex = 0.5)
par(opar)
## only the left-hand plot is considered as an
## home range estimation (the larger one)
Run the code above in your browser using DataLab