Hi
I am trying to look at wild dog density over multiple sessions (16). I have used camera traps along roads to identify individuals wild dogs over 16 months. I am trying to look at the changes in their density around control programs. I have used secr to analyse the data so far and that was successful. However, secr assumes closed populations and wild dog populations are open. I am trying to use openCR to analyse the data now but I am having issues. I am only trying to analyse the first session of the 16 at the moment. I have not worked out how to run multiple sessions.
Reading in my data, creating trap histories and so forth works fine. When I run the model I get the following error: Error in autoini(subset(capthist, occasions = primarysession == details$autoini), :
too few values for autoini
Here is my code:
dog_traps = read.traps("Ktraps.txt",
detector="count",
markocc=rep(0, 31 ))
dog_traps
#extract identified individuals
dogCapt=read.csv("Dogssess1.csv")
Knowndogs = dogCapt[-which(dogCapt$ID=="Unknown"),]
#make capture history
Kdogs = make.capthist(
captures = Knowndogs,
traps = dog_traps,
noccasions=31)
summary(Kdogs)
head(Kdogs, n=10)
summary (Kdogs)
#Tu matrix
Unknowndogs = dogCapt[which(dogCapt$ID=="Unknown"),]
Tu_dogs = matrix(data=NA, ncol=31, nrow=88)
rownames(Tu_dogs) = rownames(dog_traps)
for(j in 1:88){
for(i in 1:31){
Tu_dogs[j, i] = dim(Unknowndogs[
Unknowndogs$occasion==i &
Unknowndogs$trap==rownames(Tu_dogs)[j],])[1]
}#close i loop
}#close j loop
#unknowndogs=read.csv("DogsUsess1.csv", header=TRUE)
#Tu_dogs = matrix(data=unknowndogs, ncol=31 , nrow=213)
#rownames(Tu_dogs)=rownames(dogTraps)
#The Tm Matrix marked but unreadable tags
Tm_dogs = matrix(0,nrow(Tu_dogs),ncol(Tu_dogs))
Knowndogs = addSightings(Kdogs, Tu_dogs, Tm_dogs)
summary(Knowndogs)
#make mask
transectmask = make.mask(dog_traps, buffer = 500, type = "trapbuffer")
##model1
dog1 = openCR.fit (Knowndogs,
detectfn="HHN",
buffer = 2700,
mask=transectmask,
type="JSSAsecrD",
model=list(D~1, lambda~1, phi~1, sigma~1, z~1),
movementmodel = 'expon',
fixed = list(pID = 1.0))
coefficients(dog1)
predict(dog1)
Here is the data for the captures:
#Session ID Occasion Detector
1 Trevor 8 T3P1K
1 Julie 10 T3P4K
1 Ted 12 T3P8K
1 Hans 22 T1P19K
1 Hans 23 T1P20K
1 BT1 24 T1P10K
1 Julie 24 T3P1K
1 Trevor 24 T3P1K
1 Shortsocks 24 T3P1K
1 Trevor 31 T3P1K
1 Shortsocks 31 T3P1K
1 Julie 31 T3P4K
1 Trevor 31 T3P4K
1 Shortsocks 31 T3P4K
1 Unknown 5 T3P18K
1 Unknown 5 T3P18K
1 Unknown 7 T3P19K
1 Unknown 7 T3P4K
1 Unknown 7 T3P4K
1 Unknown 8 T2P19K
1 Unknown 8 T2P2K
1 Unknown 8 T3P4K
1 Unknown 10 T3P17K
1 Unknown 10 T3P17K
1 Unknown 10 T3P17K
1 Unknown 12 T1P2K
1 Unknown 12 T3P1K
1 Unknown 14 T3P8K
1 Unknown 19 T3P1K
1 Unknown 19 T3P1K
1 Unknown 21 T3P2K
1 Unknown 21 T3P2K
1 Unknown 23 T3P18K
1 Unknown 24 T3P1K
1 Unknown 25 T2P20K
1 Unknown 29 T3P8K
1 Unknown 29 T3P8K
Do I simply have too few detections in this session to create value?
Any help would be appreciated. If required I can post the trap values as well.
Thanks
Tracey