Hi all,
I am trying to plot population density data of wood mice for my masters degree.
I have succesfully ran the SECR code a couple of times to recieve the attached output (Mouse Density Image). I am, as is my supervisor, slightly concerned at how perfect the image is i.e. a uniform bullseye. The output doesn't quite represent the actual data we collected, in my opinion, as you can see from the number of captures at each trap (Mouse Capture Numbers - trap 45 was removed from the study which is why there arent any captures recorded for that trap). I was wondering if this output is what you would come to expect from the SECR modelling. If not, is it because I am using the wrong type of model for my data (Longworth trap capture points for three nights at a time, over four sessions)? Or have I not set a hard border around the edges of the area we were trapping, allowing the model to extrapolate the data beyond our trapping region? I have also tried refining the output further by adjusting the k value using another section of code not listed here (it is from the vignettes), but the output wasn't changed.
This is the code that I have been using, largely taken from the vignettes which have been made available:
MammalsCaptHist=read.capthist("AllMammalStatsNoDups.txt", "TrapLocations.txt", detector = "single")
traps=read.traps("TrapLocations.txt", detector = "single")
mask=make.mask(traps, buffer = 50, type = "trapbuffer")
studyarea = readOGR(".", "zoomini_BNG")
plot(mask)
plot(traps, add = TRUE)
aesc.secr = secr.fit(MammalsCaptHist, model = list(D~1, g0~1,
sigma~1), buffer=100, mask=mask, verify=FALSE)
par(cex = 0.8)
base.args = list(capthist=MammalsCaptHist, trace= FALSE)
args.0 = c(base.args, model = D ~ 1)
args.Dxy <- c(base.args, model = D ~ x + y)
args.Dxy2 <- c(base.args, model = D ~ x + y + x2 + y2 + xy)
arglist = list(null = args.0, Dxy = args.Dxy, Dxy2 = args.Dxy2)
fits = par.secr.fit(arglist,ncores = 3)
AIC (fits, criterion = "AIC")[,-2]
surfaceDxy2 = predictDsurface(fits$fit.Dxy2)
plot(surfaceDxy2, plottype = "shaded", poly = FALSE, breaks =
seq(0,25,2), title = "Density/ha", text.cex=1)
plot(surfaceDxy2, plottype = "contour", poly = FALSE, breaks = seq(0,25,2), add = TRUE)
plot(traps, add = TRUE)
From the above code I generate the Mouse Density Image.
I tried running the code without some of the model arguments:
base.args=list(capthist=MammalCaptHist, trace = FALSE)
args.0=c(base.args, model = D ~ 1)
arglist = list(null=args.0)
fits = secr.fit(arglist, ncores = 3)
However, I recieve this error:
'Error in secr.fit(arglist, ncores = 3) : requires 'capthist' object'
I can't find a resolve for this making me think that the other arguments are necessary for this function, is this the case?
I'd be appreciative if someone could shed a bit of light on this problem!
Many Thanks!