I am trying to bootstrap some radio collar data to identify sudden, significant increases in home ranges. I took the collar data and randomized the order of points using sample(), and then created a 95% MCP at every 15 cumulative points (using mcp.area() from package adehabitatHR) and stored them in a data.frame. On a normal animal, this would be the area of an MCP for the first 15pts collected, 30pts, 45pts, etc. I repeated the process 1000 times, so I had 1000 fake animals (rows) from randomized real points, and each has a list of areas (columns).
Then I created a similar data.frame with the percent change from one area calculation to the next, i.e. from one time step to the next, and took the average change for all iterations at each time step. This is what I wanted to use to compare to the real data so I could identify a shift in home range, but when I graphed it I got a strange spike in change every 4th time step. Here is the plot of mean change in area by time step.
This is what my code looks like:
cat1 <- read.csv("cat1.csv")
coordns <- data.frame(x=cat1$Longitude,y=cat1$Latitude)
coordns <- coordns[sample(1:nrow(coordns),replace=FALSE, prob = NULL),]
coordns <- SpatialPoints(coordns,
proj4string = CRS("+proj=longlat +datum=WGS84"))
coordns <- spTransform(coordns,CRSobj = "+proj=utm +zone=55 +datum=WGS84")
e <- data.frame()
t <- seq(15, nrow(cat1), by = 15)
while(nrow(e)<1000){
ar <- data.frame()
for(i in t){
ar <- rbind(ar,data.frame(mcp.area(coordns[1:i],percent=100,unout = "ha", plotit = FALSE)))
}
coordns <- data.frame(x=cat1$Longitude,y=cat1$Latitude)
coordns <- coordns[sample(1:nrow(coordns),replace=FALSE,prob=NULL),]
coordns <- SpatialPoints(coordns,
proj4string = CRS("+proj=longlat +datum=WGS84"))
coordns <- spTransform(coordns,CRSobj = "+proj=utm +zone=55 +datum=WGS84")
ar <- t(data.frame(area=ar$a))
e <- rbind(e,data.frame(ar))
}
f <- (e[,2:95]/e[,1:94])
I have run it several times with different MCP settings and length of time steps, but there is always a pattern. It's not always every 4th or as pronounced, but it's there.
Does anyone have any idea why this would be happening?
Aucun commentaire:
Enregistrer un commentaire