[R-sig-Geo] kernelbb: getverticeshr and kernel.area do not return same results
Calenge Clement
Clement.Calenge at oncfs.gouv.fr
Thu Apr 10 11:01:11 CEST 2014
Dear Anna-Marie,
> I have a problem with calculating UD areas: I calculated UDs by
> kernelbb(). When I use the getverticeshr command and after that the
> kernel.area command, the results differ. Does anyone see my mistake?
The mistake is here:
kernelcontoursha111_50 <- getverticeshr(ha111BbKern,lev=50, unout="km2")
The level should not be defined with lev, but with percent (see the help
page of getverticeshr). The correct code should therefore be:
kernelcontoursha111_50 <- getverticeshr(ha111BbKern, percent=50,
unout="km2")
However, note that the two approaches do not rely on the same algorithm
to calculate the area of the kernel home range, so that a small
difference is expected. On one hand, getverticeshr vectorizes the
contour of the home range (i.e. finds the coordinates of the vertices of
the contour polygon corresponding to a given isopleth) and then
calculates the area of the resulting polygon. On the other hand,
kernel.area uses the raster grid used for the kernel estimation to find
the pixels located in the home range, and then sums the areas of these
pixels. Therefore, a small variation is expected due to the difference
of modes (vector vs. raster) used in calculations.
For example, consider the following example (just copy and paste in R):
## use the dataset puechcirc
library(adehabitatHR)
data(puechcirc)
x <- puechcirc[1]
ud <- kernelbb(x, sig1 = 6.23, sig2 = 58, grid = 100)
kernel.area(ud, unout="km2", percent=50)
# 50
#0.3231074
getverticeshr(ud, unout="km2", percent=50)
#Object of class "SpatialPolygonsDataFrame" (package sp):
#
#Number of SpatialPolygons: 1
#
#Variables measured:
# id area
#homerange homerange 0.3164564
as you can see, the two results are pretty similar, though not exactly
identical.
Best regards,
Clément Calenge
>
> Thanks a lot and best regards,
> Anna
>
>
>> head(dcol[,c(1:11,17,25:27)])
> date day month year hour minute second time_sec time_diff latitude longitude
> 1 13.05.2011 13 5 2011 21 11 33 76293 186 54.70463 8.349938
> 2 13.05.2011 13 5 2011 21 14 37 76477 184 54.70479 8.349722
> 3 13.05.2011 13 5 2011 21 17 40 76660 183 54.70548 8.344133
> 4 13.05.2011 13 5 2011 21 20 44 76844 184 54.71007 8.338260
> 5 13.05.2011 13 5 2011 21 23 48 77028 184 54.72099 8.320427
> 6 13.05.2011 13 5 2011 21 26 52 77212 184 54.73233 8.312453
> bird_id cet xKoord yKoord
> 1 HA1_2011 2011-05-13 21:11:33 458111.9 6062117
> 2 HA1_2011 2011-05-13 21:14:37 458098.1 6062135
> 3 HA1_2011 2011-05-13 21:17:40 457738.7 6062216
> 4 HA1_2011 2011-05-13 21:20:44 457365.1 6062730
> 5 HA1_2011 2011-05-13 21:23:48 456227.9 6063956
> 6 HA1_2011 2011-05-13 21:26:52 455726.7 6065223
>
>
>
> #### create ltraj elements:
> ##HA1_2011
> ha111<-subset(dcol,bird_id=="HA1_2011")
> ha111time <- ha111[, c("cet")]
> ha111XY <- ha111[,c("xKoord", "yKoord")]
> ha111ltraj <- as.ltraj(ha111XY, ha111time, id="HA1_2011")
> ha111Liker <- liker (ha111ltraj, sig2=20, rangesig1=c(1,100) )
> ha111Liker
> head(ha111Liker)
> ha111BbKern <- kernelbb(ha111ltraj, sig1=18.5405, sig2=20)
>
> kernelcontoursha111_50 <- getverticeshr(ha111BbKern,lev=50, unout="km2")
> # Object of class "SpatialPolygonsDataFrame" (package sp):
>
> Number of SpatialPolygons: 1
>
> Variables measured:
> id area
> homerange homerange 6.055773
>
> ## kernel areas:
> ha111area<-kernel.area(ha111BbKern, unout=c("km2"),percent=50) ## 0.9744107
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
--
Clément CALENGE
Cellule d'appui à l'analyse de données
Direction des Etudes et de la Recherche
Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33) 01.30.46.54.14
More information about the R-sig-Geo
mailing list