##OpenBUGS implementation of the combined known-fate open N-mixture model for the ##applied wolf survival and recruitment example model { #Priors #Survival beta.int~dunif(-5,5) beta1.int~dunif(-5,5) for(i in 2:9){ beta[i]<-beta.int beta1[i]<-beta1.int } #Recruitment for(i in 1:5){ mean.count[i]~dunif(-3,3) recruit3[i]~dunif(-3,3) } #Detection p.int[1]~dunif(0,1) p.int[2]<-0.99999 #Between-year survival (April-May) btw.yr.surv1<-1/(1+exp(-beta.int)) btw.yr.surv2<-1/(1+exp(-beta1.int)) #May-Aug survival, period 1 beta[1]<-logit(pow(1/(1+exp(-beta.int)),3)) beta1[1]<-logit(pow(1/(1+exp(-beta1.int)),3)) #Model for collared animals for(i in 1:144){ mu[i,1]<-collar.prev.yr[i]*(btw.yr.surv1)+collar.not.prev[i] #if previously collared, estimate between-year survival y.collar[i,1]~dbern(mu[i,1]) for(j in (first[i]+1):last[i]){ #Basically a nest survival model here logit(phi[i,j-1])<-beta[j-1] #Collared animal survival mu[i,j]<-phi[i,j-1]*y.collar[i,j-1] y.collar[i,j]~dbern(mu[i,j]) } } #Model for counts of rest of pack members #Getting initial counts in May (beginning of year) for(i in 1:16){ #Study initiated, 16 packs marked n[i,1]~dpois(mean.count1[i,1]) #Initial number in group log(mean.count1[i,1])<-mean.count[year.count[i]] #Year-specific initial group size n1[i,1]<-n[i,1] #May only } for(i in 17:25){ #9 newly marked packs, some collars added n[i,1]~dpois(mean.count1[i,1]) #Initial number in group log(mean.count1[i,1])<-mean.count[year.count[i]] #Year-specific initial group size n1[i,1]<-n[i,1]-new.col[i,1] #Accounting for removals to the collared sample } for(i in 26:88){ #packs marked in previous years n[i,1]~dbin(btw.yr.surv2,n1[prev.count.pos[i],10]) #Between year survival (i.e. Apr-May) n1[i,1]<-n[i,1]+(recruit[i])-new.col[i,1] #Survived, recruits, remove new collars } #Recruitment submodel (recruits only added in May (period 1)) for(i in 1:88){ recruit[i]~dpois(recruit2[i]) lrecruit2[i]<-recruit3[year.count[i]] recruit2[i]<-exp(lrecruit2[i]) for(j in 1:10){ #10 revisit periods, 9 intervals (May-Aug = inteval 1) pp[i,j]<-p.int[test[i,j]] #Test indicates whether counts were perfect y.count[i,j]~dbin(pp[i,j],n1[i,j]) } #Survival of uncollared animals for(j in 2:10){ lphi.1[i,j-1]<-beta1[j-1] phi.1[i,j-1]<-1/(1+exp(-lphi.1[i,j-1])) n1[i,j]<-n[i,j]-new.col[i,j] #Remove newly collared individuals from the count n[i,j]~dbin(phi.1[i,j-1],n1[i,j-1]) } } }