[R] Problem defining a grid in adehabitatHR (kernelUD)

David Villegas Ríos chirleu at gmail.com
Thu Jan 29 14:51:46 CET 2015


Hi all,
I'm trying to estimate a HR area for several individuals using kernelUD and
kernel.area in adehabitatHR library.
My code is:

   library(adehabitatHR)
   h=50

 kud=kernelUD(detections[,1],h=h,grid=grid,extent=extent,kern=c("bivnorm"))
   area=kernel.area(kud,percent=95,unin ="m",unout="km2")

If I set for example grid=300 and extent=0.5, and same4all=TRUE, I get
apparently correct values. If I modify extent/grid, the output is pretty
much the same.

However I want to manually construct my grid based on a polygon delimited
by some coordinates that define the study area. Like this:

   library(raster)

   # define the coordinates (all the detections fall inside the polygon)
   polyx<-c(495000,499000,499000,495000,495000)
   polyy<-c(6494000,6494000,6498500,6498500,6494000)
   loc=as.data.frame(cbind(polyx,polyy))
   coordinates(loc)=c("polyx","polyy")
   proj4string(loc) <- CRS("+proj=utm +zone=32")

   # create the raster
   loc4=raster(loc,nrows=1000,ncols=1000)

   #transform to SpatialPixels class so it can be recognised by kernelUD()
   loc5=as(loc4, "SpatialPixelsDataFrame")

   grid=loc5
   extent=0.5

 kud=kernelUD(detections[,1],h=h,grid=grid,extent=extent,kern=c("bivnorm"))
   area=kernel.area(kud,percent=95,unin ="m",unout="km2"))

I get incorrect values (all individuals the same incorrect HR), and the
following warnings():

   In kernel.area(j, percent, unin, unout) :
   The grid is too small to allow the estimation of home-range
   for the following value of percent: 95. You should rerun kernelUD with
a larger extent parameter

I tried different extent values up to 20 and still get the same warnings
and erroneous values of HR...

Any idea of what am I doing wrong?

Thanks in advance,

David

	[[alternative HTML version deleted]]



More information about the R-help mailing list