ADEHabitat Smoothing parameters Sig1and2

110 Views Asked by At

I am trying to build some BBMM code and although it produces the outputs I want, I am having trouble figuring out the proper smoothing parameters using Sig 1 and Sig 2. When I use the liker function it produces the exact same curve for every individual, which does not seem right. I have tried playing with the Sig 2 number and range of sig1 but it does not seem to make any difference at all. What am I missing?

Example data

`#Load Package library(BBMM) library(sp) library(adehabitatHR) library(adehabitatLT)

##Plot Movement Rates for individuals

ctraj <- as.ltraj(xy = coordinates(RelSPDF), date = RelSPDF$Timestamp, id =RelSPDF$Animal_ID)

is.regular(ctraj)

graphics.off()

par("mar")

par(mar=c(1,1,1,1))

plotltr(ctraj)

###Establish smoother Sig1 and Sig2 parameters

x <- ctraj

lik <- liker(x, sig2 = 6, rangesig1 = c(1, 50))

xbb <- kernelbb(x, sig1 = 300, sig2 = 6, grid=1500)

image(xbb)

plot(getverticeshr(xbb, 95), add=TRUE, lwd=2)

plot(ctraj)`

Sigma

I am using R 2021.09.0, 64Bit

1

There are 1 best solutions below

0
On BEST ANSWER

You need to try adjusting the rangesig1 to a different range. This is your standard deviation. See below, which is copied from the help page. View it in R with ?liker

## Field studies have shown that the mean standard deviation (relocations
## as a sample of the actual position of the animal) is equal to 58
## meters on these data (Maillard, 1996, p. 63). Therefore
sig2 <- 58

## Find the maximum likelihood estimation of the parameter sig1
## First, try to find it between 10 and 100.
liker(x, sig2 = 58, rangesig1 = c(10, 100))

## Wow! we expected a too large standard deviation! Try again between
## 1 and 10:
liker(x, sig2 = 58, rangesig1 = c(1, 10))

## So that sig1 = 6.23

You also need to make some adjustments to the code you have provided, including transforming your Timestamp to POSIXct and providing coordinates in the correct format.

Below is your code edited to do this.

RelSPDF<- read.csv("yourdata.csv")

#change Timestamp to POSIXct
# ymd_hms stands for year,month,day,hours,mins,secs
# Ensure this is in the correct order to match your data 

library(lubridate)
RelSPDF$Timestamp<- ymd_hms(RelSPDF$Timestamp) 

#Load Package 
#library(BBMM) # this package is no longer available
library(sp) 
library(adehabitatHR) 
library(adehabitatLT)

##Plot Movement Rates for individuals


#convert your coordinates 

xy <- RelSPDF[,c(4,3)] # 3 and 4 are the column numbers - long is x


#then set them up as an xy for the next part of your code

xy <- coordinates(xy)

####

ctraj <- as.ltraj(xy = coordinates(xy), date = RelSPDF$Timestamp, id =RelSPDF$Animal_ID)


###Establish smoother Sig1 and Sig2 parameters

par(mar=c(1,1,1,1))

x <- ctraj

lik <- liker(x, sig2 = 6, rangesig1 = c(1, 50)) # adjust the rangesig1 range to suit your data