Use distribution (95%) as calculated using reference bandwidth.

This is an example of how I wanted to calculate Grizzly Bear home ranges.

**Success:** Remembered how to write R code, and figured out adehabitatHR package in two hours.

**Failure:** Unfortunately, using the Least Square Cross Validation smoothing parameter requires “cross-validation to be minimized,” and none of my tests satisfied this, so we’re going to use another method. The above picture was made using the “reference bandwidth” (substitute “href” for “LSCV”) – it tends to overestimate the area used by the individual in question, so we’re not using that, either.

Anyway, here’s the code, as much a reminder for me how to write R code as anything:

1. Install and load adehabitatHR and maptools packages.

install.packages(pkgs=c(“adehabitatHR”,”maptools”), repos=”http://cran.r-project.org”)

library(adehabitatHR)

library(maptools)

2. Read a shapefile into a SpatialDataPointsObject.

shape <- readShapePoints(“H:/GIS_Data/bear”)

3. Calculate use distribution, by bear (identified in the first column, shape[,1]), using the Least Squares Cross Validation smoothing parameter.

kud <- kernelUD(shape[,1],h=”LSCV”,grid=500)

4. Make a polygon (SpatialPolygonDataFrame) of the area of 95% probability.

hr <- getverticeshr(kud, percent=95)

5. Save the polygon to a shapefile.

writePolyShape(hr,”H:/GIS_Data/op”)

### Like this:

Like Loading...