0

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.

traps file format

Capt file format

Thanks in advance for any advice as I am really struggling to complete this analysis.

Full capt file (dummy data)

Full trap file (actual data)

  • please provide the reproducible data. – Cyrus Mohammadian Dec 15 '18 at 05:20
  • Unfortunately Cyrus I'm obligated by a research contract not to share data publically which is why I only provided an example of the data. I'm hopeful that somebody with knowledge of spatially explicit capture recapture and the package secr will have encountered this error or know what sorts of issues may usually lead to such an error. – Shannon.b.ltu Dec 16 '18 at 02:01
  • You can always provide sample data by simulation/random generation... – Cyrus Mohammadian Dec 16 '18 at 20:43
  • 1
    Great idea Cyrus. I should have thought of that but it has been a very tough week. I have attached two new tables with the data by editing the original post. It had occurred to me to change the data point for OUT01 from a 0 to 1 and see if that helps solve the problem. The problem with that occurred when trying to read in the edited file. For the following function I get this error when using the edited file. – Shannon.b.ltu Dec 18 '18 at 10:33
  • captfile <- "captfile_both.csv" trapfile <- "trapfile_both.csv" bothCH <- read.capthist(captfile = captfile, trapfile = trapfile, skip = 1, detector = "proximity", covnames = c("age")) – Shannon.b.ltu Dec 18 '18 at 10:34
  • Error in read.table(file, row.names = 1, as.is = T, colClasses = colcl, : duplicate 'row.names' are not allowed – Shannon.b.ltu Dec 18 '18 at 10:34

0 Answers0