I use the par.secr.fit function quite a bit and have run into a bit of a nuisance issue. Model specification errors are not caught or reported until the very end, and when they occur, the results of the models that do complete are not saved. For example, I might specify 3 models but accidentally misspell a covariate in one of them (the covariate on sigma in the third model, in this example):
- Code: Select all
fitnm.bkTT.1 <- list(capthist="captHist", model=list(D~1, g0~bk+trapType, sigma~1), mask=mask2, hcov="sex", trace=TRUE, method="Nelder-Mead", control=list(maxit=1500))
fitnm.bkTTsex.1 <- list(capthist="captHist", model=list(D~1, g0~bk+trapType+h2, sigma~1), mask=mask2, hcov="sex", trace=TRUE, method="Nelder-Mead", control=list(maxit=1500))
fitnm.bkTT.TT <- list(capthist="captHist", model=list(D~1, g0~bk+trapType, sigma~traptype), mask=mask2, hcov="sex", trace=TRUE, method="Nelder-Mead", control=list(maxit=1500))
fits3 <- par.secr.fit(c("fitnm.bkTT.1", "fitnm.bkTTsex.1", "fitnm.bkTT.TT"), ncores=3)
Instead of immediately reporting the error and halting the process, the remaining two models continue to be processed, but upon completion, the following error is reported:
- Code: Select all
[Error in checkForRemoteErrors(val) :
one node produced an error: covariate(s) traptype not found
The "fits3" object that should have contained the results of the three models is not produced and the process must be started from the very beginning after the error is corrected. An ideal behavior would be either to first detect the error and halt the entire process from the very beginning, or to save the results of the models that do run to completion and simply report the error for the ones that do not.
Aside from being more diligent in checking my code before I run it, is there anything that can be done to retrieve the results from the models that do not produce errors?
Thanks!