Does the model represent the data accurately?

133 views
Skip to first unread message

Devlan Alkins

unread,
Jul 22, 2020, 12:51:28 PM7/22/20
to secr
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!

Mouse Capture Numbers.png
Mouse Density Image.jpeg

Murray Efford

unread,
Jul 22, 2020, 6:12:34 PM7/22/20
to secr
Devlan

When you fit a quadratic trend model for density you inevitably end up with a single peak (bullseye) - the only slightly disconcerting point is that this is centred N-S in your example. Perhaps you are expecting too much from the density surface: with typical small datasets one cannot resolve spatial patterns of density, despite the numerous published pictures that seem to do this.

Note that the 'buffer' argument of secr.fit has no effect when you specify 'mask'. Also, you probably mean your base.args to include mask
base.args <- list(capthist = MammalsCaptHist, mask = mask, trace = FALSE)

Your last problem seems to be due to a spelling mistake (MammalCaptHist).

Murray

Devlan Alkins

unread,
Jul 24, 2020, 6:20:45 AM7/24/20
to secr
Hi Murray,

Thank you for your reply. 

So am I right in thinking that if I were to apply some other model which was not quadratic then I would get a different output? Or is the SECR model always quadratic? 

I have also now somehow generated another issue. When I go to create my caphist object using the following code:

MammalsCaptHist=read.capthist("AllMammalStatsNoDups.txt", "TrapLocations.txt", detector = "single")

I recieve this error:

Error in `[.default`(DF, chr) : invalid subscript type 'list'

I have not had this error before and I haven't changed the code since I posted here the first time.

Please could you help?

Thanks,

Dev

Murray Efford

unread,
Jul 24, 2020, 6:05:17 PM7/24/20
to secr
Devlan

You choose the model for density in the model argument of secr.fit(). The default D~1 is a constant (flat) surface. Anything more is up to you. The builtin predictors x,y,x2,y2,xy allow you to construct some fairly uninterseting linear or quadratic trend surfaces. More interesting would be models for D in terms of spatial covariates in the mask object: the pattern then depends on the spatial pattern of the covariate(s). Another possibility is regression spline smooth trend surfaces (e.g., ?smooths).

I can't put my finger on where your other error is coming from. It smells a little like a problem with the new R 4.0. Which versions of secr and R are you using?

Murray
Reply all
Reply to author
Forward
0 new messages