How do I make an ad hoc smoothing parameter in the Adehabitat HR package?


#1

Hi guys, I am new here and I have no idea in which category to put this.

I am doing my master thesis about home ranges, and the datas I am using come from GPS points of 8 different individuals.

I am using the package adehabitatHR, and I used the smoothing parameter h=href at first. It gives me huge, circular home ranges. A friend told me I can change the smoothing parameter to a fraction of href (0.8*href for instance) to fit my data better.

However, I have no idea to do that.

Here is my original script:

#############################################################################################

Calcul des domaines vitaux des Micromys de Greny, Automne 2017

Utilisation de la methode kernel

Fixed kernel with Href smoothing, grid = 80 and extent = 2, contour level = 80%

######################################################################

Packages utiles: sp/rgeos/maptools pour graphique et adehabitatHR pour DV

library(sp)
library(rgeos)
library(maptools)
library(adehabitatHR)
library(readxl)

Dossier de travail

setwd("C:/Users/Fanny/Documents/ArcGIS/Master_thesis/RStudio/Coordonnées RStudio/Lambert veg")

Fichier des localisations

loc <- read_excel("C:/Users/Fanny/Documents/ArcGIS/Master_thesis/RStudio/Coordonnées RStudio/Lambert veg/Radiotracking_all.xlsx")
head(loc)

Transformation en format SpatialPoints pour pouvoir utiliser les fonction de adehabitatHR

Attention adapter les numeros de colonne en fonction du tableau !

coor <- loc[,c(8,9)]
head(coor)
coordinates(loc) <- coor
class(coor)

Choosing the smoothing paremeter method : h="href" => reference de bandwidth

h="href"

Grid Initialisation to estimate the utilization distribution (UD)

Grid resolution

grid = 200

Taille de la grille

extent = 2

Estimation of the UD : the surface is in m2 (Remember that the first column of the component "loc" of this dataset contains the identity of the animals)

kud <- kernelUD(loc[,3], h, grid,extent)
head(kud)
image(kud)

Estimation du DV Ã partir de l'UD

Choosing the threshold probability

hrs <- kernel.area(kud, percent=seq(50, 95, by=5), unin = "m", unout= "m2")
plot(hrs)
seuil = 80

Estimation sous forme de couche vectorielle

dv <- getverticeshr(kud, percent = seuil, unin = "m", unout="m2")
class(dv)
head(as.data.frame(dv))

plot(dv)

Export DV

setwd("C:/Users/Fanny/Documents/ArcGIS/Master_thesis")
writePolyShape(dv, paste("dv_kernel_all","",h,"",seuil))

Export des DV en csv

setwd("C:/Users/Fanny/Documents/ArcGIS/Master_thesis")
write.table(as.data.frame(dv), paste("dv_kernel_all","_",h,".csv"), row.names=FALSE, sep=";",dec=",", na=" ")

Here are some information my friend gave me but I have no idea how to apply them:

to calculate each hrefs (?):
hrefs <- c(785.0429, 638.4495, 774.7266, 870.8454, 1009.547, 1239.997)
hrefs0.9 <- hrefs0.9
hrefs0.8 <- hrefs
0.8
hrefs0.7 <- hrefs0.7
hrefs0.6 <- hrefs
0.6
hrefs0.5 <- hrefs0.5
hrefs0.4 <- hrefs
0.4
hrefs0.3 <- hrefs0.3
hrefs0.2 <- hrefs
0.2
hrefs0.1 <- hrefs*0.1

To precise which individual (?):
al_kud_adhoc5 <- kernelUD(Alto, h=hrefs0.5[1], same4all=TRUE)

Can anyone help me?
Thank you


#2

Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

Right now the best way to install reprex is:

# install.packages("devtools")
devtools::install_github("tidyverse/reprex")

If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. The reprex dos and don'ts are also useful.

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "fruits_stringdist.md")

For pointers specific to the community site, check out the reprex FAQ, linked to below.


#3

Thank you for the answer, I really tried, but I didn't manage to use reprex.