questionable home range values with mcp() (minimum convex polygon) in R

173 Views Asked by At

I am trying to calculate the home range of a whole species and seperate two groups based on sex. I used mcp() and it runs but the output is questionable.

Here is my data


library(raster)
library(dismo)
library(rgdal)
library(dplyr)
library(tidyverse)
library(tidyselect)
library(sp)
library(adehabitatHR)
library(scales)
cat.shark.data <- read.csv2("C:/Users/jcdeb/OneDrive/Bureaublad/SASC/hopefully last file  ever.csv", header=T)
head(cat.shark.data)

Common.name Sex..M.F.     Long       Lat
1 Pyjama Catshark         F 19.34785 -34.75671
2 Pyjama Catshark         F 19.29512 -34.61850
3 Pyjama Catshark         M 19.29512 -34.61850
4 Pyjama Catshark         M 19.29512 -34.61850
5 Pyjama Catshark         M 19.29512 -34.61850
6 Pyjama Catshark         F 19.34581 -34.55419

# converting Lat long spatialpoints to UTM zone 34 spatialPoints
cord.dec = SpatialPoints(cbind(cat.shark.data$Long, cat.shark.data$Lat), proj4string=CRS("+proj=longlat"))
cord.dec
cord.dec@coords
zone <- 34
# used example from
# https://stackoverflow.com/questions/38621660/unexpected-convertion-output-from-latlong-to-utm-in-r  
cord.UTM <- spTransform(cord.dec, CRS(paste("+proj=utm +south +zone=",zone,"ellps=WGS84",sep='')))
cord.UTM

par(mfrow = c(1, 2))
plot(cord.dec, axes = TRUE, main = "Lat-Long Coordinates", cex.axis = 0.95)
plot(cord.UTM, axes = TRUE, main = "UTM Coordinates", col = "red", cex.axis = 0.95)

# replace column with Lat and Long for UTM coordinates 
cord.dec.coords <- as.data.frame(cord.UTM@coords)
cat.shark.data$Lat <-cord.dec.coords$coords.x1
cat.shark.data$Long <- cord.dec.coords$coords.x2
plot(cat.shark.data$Long, cat.shark.data$Lat)

This part should be fine because I checked the longlat to UTM conversion and the coordinates do correspond with the right UTM values. Thus, i think the problem lies in the next part :

par(mfrow = c(1, 1))
x<- cat.shark.data[,"Long"] 
y<- cat.shark.data[,"Lat"]
plot(x,y)
shark.sp<- cat.shark.data[,c("Sex..M.F.", "Long", "Lat")]
coordinates(shark.sp)<- c("Long", "Lat")
class(shark.sp)
slot(shark.sp, "proj4string") <- CRS( "+proj=utm +zone=34 +datum=WGS84 +units=m +no_defs" )
#proj4string(shark.sp) <- CRS( "+proj=utm +zone=34H +datum=WGS84 +units=m +no_defs" ) # should be the same right ?
shark.MCP<- mcp(shark.sp, percent = 95, unout = c( "km2"))
shark.MCP
Object of class "SpatialPolygonsDataFrame" (package sp):

Number of SpatialPolygons:  2

Variables measured:
  id     area
F  F 49.26988
M  M 49.26988

plot(shark.sp, col = as.factor(shark.sp@data$Sex..M.F.), pch = 16)
plot(shark.MCP, col = alpha(1:5, 0.5), add = TRUE)
hrs <- mcp.area(shark.sp, percent = seq(50, 100, by = 5))
hrs
              F           M
50     50.91919    50.91919
55     50.91919    50.91919
60     50.91919    50.91919
65     50.91919    50.91919
70     50.91919    50.91919
75    233.67845    57.53127
80    299.54642    87.06809
85    301.38459   127.67519
90    633.39131   606.42969
95   4926.98764  4926.98764
100 34146.77787 20543.01517

when I plot the datapoints they look like they have realistic spacing and for the species it would not be unlikly if the 95% homerange was around 50 km2. However, it is very unlikely that females and males have the exact same homerange and when I look at the hrs results they dont't add up at all. Unfortunately, this is the first time I tried this so i have no idea where the problem lies.

I also get this warning after the mcp() code line :

In proj4string(xy) :
  CRS object has comment, which is lost in output; in tests, see
https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html

and 11 warnings when I run the hrs() code. However, I took this site a reference and tried out their script with their data: https://jamesepaterson.github.io/jamespatersonblog/03_trackingworkshop_homeranges and got the same warning while still getting the same results as the example.

I looked into the warnings and even adjusted some of the code to solve it but I still get the warning and the same results.

edit: after playing around more with the code I only get the warning if I run this code line

slot(shark.sp, "proj4string") <- CRS( "+proj=utm +zone=34 +datum=WGS84 +units=m +no_defs" )

Does someone know where I go wrong because I have tried a lot and nothing seems to work.

thank you in advance !

1

There are 1 best solutions below

0
On

I would try and split the sharks points into male and female before you run the mcp on the points and see if that gives more realistic results.