I cannot resolve the below error after having already considered the vignettes and a search on forums.
I am undertaking a multi session analysis using the package secr in R (developed by Murray Efford).
When I run this model
fit_age0 <- secr.fit(bothCH, mask = mask, detectfn = 2, trace = F, hcov = 'age')
I get this error
Error in FUN(X[[i]], ...) : mixture models fail when the first detector is not used on the first day.
The code used to create the relevant capthist file is below. I would reduce this down further if I knew where the specific problem was. Please let me know if there is additional information that is needed to help answer this question.
library(secr)
library(RColorBrewer)
library(sp)
library(rgdal)
library(GISTools)
library(raster)
library(readxl)
#--------------------
###Input files and create capthist####
captfile <- "captfile_both.xlsx"
trapfile <- "trapfile_both.csv"
suggest.buffer(bothCH)
#########
#276 395#
#########
# quick and biased estimate of sigma (metres)
initialsigma_both <- RPSV(bothCH, CC = TRUE)
initialsigma_both
##############
#$`OUT` #
#[1] 85.34081#
# #
#$IN #
#[1] 118.8134#
##############
buffer <- 800
bothCH <- read.capthist(captfile = captfile, trapfile = trapfile,
skip = 1, detector = "proximity",
covnames = c("age"))
bothCH <- split(bothCH, grepl('IN',rownames(traps(bothCH))), bytrap = TRUE)
# drop last 2 occasions for OUT (no cameras working)
bothCH[[1]] <- subset(bothCH[[1]], occasions=1:78)
usage(traps(bothCH[[1]])) <- usage(traps(bothCH[[1]]))[,1:78]
#### Clear repeat observations
bothCH <- reduce(bothCH, dropunused = FALSE)
verify(bothCH)
session(bothCH) <- c('OUT',"IN")
Examples of my trap file and capt file layouts are below.
Thanks in advance for any advice as I am really struggling to complete this analysis.