This looks familar
You don't say whether you want to use sex as a covariate for density (i.e. separate estimates for the density of each sex) or just detection parameters (g0, sigma). I'll assume both.
From the code you've given it looks like you successfully created a capthist object with a (presumably) categorical individual covariate 'sex'. This is sitting there waiting to be used (obviously it isn't used in your first model).
Unfortunately, there are many ways to proceed. The one I recommend is to use the new variation on mixture models which (i) is not fully documented (but see
http://www.otago.ac.nz/density/pdfs/secr-finitemixtures.pdf), and (ii) estimates both total density and sex ratio.
- Code: Select all
secr.fit (myALL, model=list(D~session,g0~h2,sigma~h2), hcov = 'sex', CL=FALSE, buffer=400, trace=FALSE)
[In principle you can also use this with CL=TRUE and no D in the model (save the fitted model and use derived() to get session-specific densities). BUT there is a bug in the present release that crashes R with this combination, so don't use it until I get out a new release, hopefully within days.]
Two other ways are
- Code: Select all
fit <- secr.fit (myALL, model=list(g0~sex,sigma~sex), CL=TRUE, buffer=400, trace=FALSE)
derived(fit, groups = 'sex')
and
- Code: Select all
secr.fit (myALL, model=list(g0~g,sigma~g), groups='sex', CL=FALSE, buffer=400, trace=FALSE)
I can't test this code, but you should get the idea.
Murray