[R-sig-Geo] adehabitatHR use different bandwidth for kernelUD
Maren Huck
M.Huck at derby.ac.uk
Thu Aug 11 10:29:26 CEST 2016
Dear Hagen,
It is possible. I copy some code that I have used myself, so you would have to adapt it.
First, you have to make sure that the kernel is calculated based on the same underlying grid. If you use slightly different h-values, these are normally slightly different.
minX<-min(my_data$X_POS) # calculate minimum and maximum values of the locations
maxX<-max(my_data$X_POS)
minY<-min(my_data$Y_POS)
maxY<-max(my_data$Y_POS)
a <- seq(minX-0.002*minX,maxX+0.002*minX,by=11.4) # where resolution is the pixel size you desire, you might have to play around with these values. Perhaps have a look at the typical values first
b <- seq(minY-0.0001*minY,maxY+0.0001*minY,by=11.4)
ab <- expand.grid(x=a,y=b)
coordinates(ab) <- ~x+y
gridded(ab) <- TRUE
class(ab)
udhref_all<- kernelUD(my_data[,1], h="href", grid=ab)
KernelFloater<- kernelUD(Floatersp, h=86, grid=ab)
KernelB68<- kernelUD(B68sp, h=26, grid=ab)
listuds<-list(Solitary = KernelFloater, B68 = KernelB68) # the list can be as long as you want. The name before the = is just the name you will see in your output
class(listuds)<-"estUDm"
kerneloverlaphr(listuds, method = "HR", percent =95, grid=ab)*100 # to get the overlap in percent overlap
kerneloverlaphr(listuds, method = "UDOI", percent =95, grid=ab) # to get the Utilization distribution overlap index
The bit about the grid I found somewhere online when googling. Maybe try to google for
"ab <- expand.grid(x=a,y=b)"
because I think that is one of the original codelines there. You might get further explanations theree.
Hope that helps,
Maren
(P.S. If you have further questions, you can also e-mail me directly and in German)
Maren Huck
Dep. of Natural Sciences
University of Derby
Kedleston Road
Derby DE22 1GB
U.K.
Tel: +44-1332-592354
m.huck at derby.ac.uk
________________________________
From: R-sig-Geo <r-sig-geo-bounces at r-project.org> on behalf of proleet at web.de <proleet at web.de>
Sent: 10 August 2016 22:10:50
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] adehabitatHR use different bandwidth for kernelUD
Hello everyone,
this is my first question so I hope I do everything right. I am working with adehabitatHR and I am new to R. I want to calculate the home range overlap with the function "kerneloverlaphr". In order to do so I have to produce KDE for every animal with the function "kernelUD". My input data contains only the animal-id and the xy-coordinates. I wonder if it is possible to assign a different bandwith (h) each animal because i calculated it with a procedure not implemented in adehabitatHR. "kernelUD" applies the same bandwidth to all animals. The code for "kernelUD" is:
kernelUD(xy, h = "href", grid = 60, same4all = FALSE, hlim = c(0.1, 1.5), kern = c("bivnorm", "epa"), extent = 1,boundary = NULL)
Thanks in advance and best regards
Hagen
The University of Derby has a published policy regarding email and reserves the right to monitor email traffic.
If you believe this was sent to you in error, please reply to the sender and let them know.
Key University contacts: http://www.derby.ac.uk/its/contacts/
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list