by CHWarbington » Wed Oct 30, 2019 1:28 pm
Hello once more -
I want to sum up the issues I am having, so if anyone can provide some guidance that the errors will be more clear.
I am working on a density estimate using secrlinear, meaning that the animals move along a network (river system in this case) and all activity centres are also on the river system.
I intend to do a model selection, varying g0, sigma, and density by Session, h2, and /or sex in different models and comparing AIC.
The animals are identifiable based on coat markings, hence knownmarks = FALSE is appropriate under the details part of the secr.fit command.
I am combining detections from camera traps and human observers, which vary in lengths of deployment. I also varied the location and active periods of the camera traps during different sessions, thus using a trap usage file / varying effort specification is also appropriate.
I originally fit the data omitting the trap usage files and also omitting knownmarks = FALSE. I fit a set of 10 candidate models, and all but one concluded without error. The model that failed was D ~ Session, sigma ~ h2, and the error was "at least one variance calculation failed."
thus I started fitting models with the varying effort and knownmarks = FALSE commands.
I ran into the unrecognized capthist object issue when trying to incorporate the trap usage files. That sequence of code and the subsequent error is related in the first post in this thread, copied here:
fullcapt <- read.csv("FullID_sex.csv", header=TRUE)
traps <- read.traps("LinearTraps.csv", detector = "count", sep = ",",
binary.usage = FALSE)
# Trap Usage files for each year
t15 <- read.csv("TrapUsage2015.csv", header=TRUE)
t16 <- read.csv("TrapUsage2016.csv", header=TRUE)
t17 <- read.csv("TrapUsage2017.csv", header=TRUE)
s.data <- make.capthist(fullcapt, traps, covnames = list("Sex"),
fmt="trapID")
## Assign the trap usage lists
uselist <- list(t15, t16, t17)
# insert each usage matrix in relevant traps object
for (i in 1:3) usage(traps(s.data)[[i]]) <- uselist[[i]]
summary(traps(s.data))
But when I try to run a fit, such as:
L.null <- secr.fit(s.data, model = g0 ~ 1, mask = rivermask,
method = 'Nelder-Mead', trace = FALSE,
details = list(knownmarks = FALSE,
userdist = networkdistance(traps, rivermask)))
I get the error message:
Error in secr.fit(s.data, model = g0 ~ 1, mask = rivermask, method = "Nelder-Mead", :
requires 'capthist' object
I do not get the error when I omit the trap usage files. (meaning skipping the uselist command and the for loop above)
This brings me to the second issue:
Using knownmarks - FALSE in secr.fit leads to optim returns convergence 1 errors, in models where I allow sigma to vary by a hybrid mixture model. I get this error even when specifying the starting values from models that were fit successfully.
I am only comparing the results within a "set", meaning all the models with knownmarks = FALSE are compared to each other, and only those omitting knownmarks are compared.
So, my questions are:
It appears that I am unable to use the trap usage files to signify the varying effort between sessions. Am I coding it incorrectly?
Due to the use of different types of detectors, can I omit the trap usage files and still have a useful result?
Is the optim convergence 1 a fatal error that precludes the usefulness of the results?
If it is, can I use the results from models that omit the knownmarks - FALSE command, or does this introduce more problems by ignoring the types of marks?
Also, I know that the first post contains code omitting the network distance. I fit the data using the network distance and "standard" secr, to compare results and density estimates only. I get the optim convergence 1 error in "standard" secr and secrlinear, so I did not change the code.
Another sample code that returns the optim 1 error is:
L.Fullh2_2 <- secr.fit(s.data, model = list(g0 ~ h2 + Session, sigma ~ h2 + Session,
+ D ~ Session),
+ mask = rivermask, method = 'Nelder-Mead', trace = FALSE,
+ details = list(knownmarks = FALSE,
+ userdist = networkdistance(traps, rivermask)),
+ start = L.Sex)
Where L.Sex was fit without the optim convergence 1 error and was coded thus:
L.Sex <- secr.fit(s.data, model = list(g0 ~ h2, sigma ~ h2), hcov = "Sex",
mask = rivermask, method = 'Nelder-Mead', trace = FALSE,
details = list(knownmarks = FALSE,
userdist = networkdistance(traps, rivermask)),
start = L.null)
Thank you so much for any response!