I am trying to calculate the home range overlap for kernel home ranges
from the same trajectory but calculated with different smoothing
parameters to compare their similarty. This means I have two or more
objects of type khrud that I need to combine into one to make them
work with the kerneloverlaphr() function. Is there an easy way to
combine two khrud objects or will I have to rewrite the
kerneloverlaphr function?
Actually, there is no need to rewrite the kerneloverlaphr function: just
use c() to combine your kud objects (computed using the same grid), give
the elements of the list a name, and define the class of the resulting
list to be c("khrud", "khr").
For example (just copy and paste):
## relocations of two animals
chou <- puechabon$locs[puechabon$locs$Name =="Chou",c("X","Y")]
jean <- puechabon$locs[puechabon$locs$Name =="Jean",c("X","Y")]
## you need the same grid for all animals, so here, we will the function
kernelUD to compute it,
## but it will not be needed if you already have a grid.
## The smoothing parameter is not important here. We use this code to
compute the
## grid used for the computation of the overlap (the actual value of the
UD is not important
## here)
all.an <- puechabon$locs[ (puechabon$locs$Name
=="Jean")|(puechabon$locs$Name =="Chou"),c("X","Y")]
all.fac <- factor(puechabon$locs$Name[ (puechabon$locs$Name
=="Jean")|(puechabon$locs$Name =="Chou")])
k.all <- kernelUD(all.an, all.fac, grid=200, same4all=TRUE)
## Estimate the UD on the grid computed previously (we choose here the
grid k.all[[1]]$UD, but
## we could have chosen k.all[[2]]$UD: they are identical)
## for Chou, for example, h=250 m
kchou <- kernelUD(chou, h = 250, grid=k.all[[1]]$UD, same4all=TRUE)
## for Jean, for example, h= 800 m
kjean <- kernelUD(jean, h=800, grid=k.all[[1]]$UD, same4all=TRUE)
## combine the two results:
ktot <- c(kchou, kjean)
## give them a name and a class:
names(ktot) <- c("Chou","Jean")
class(ktot) <- class(kjean)
## And compute the overlap:
kerneloverlaphr(ktot)
HTH,
Best wishes,
Clément Calenge
--
Clément CALENGE
Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33) 01.30.46.54.14
_______________________________________________
AniMov mailing list
[email protected]
http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov