#################################################################################################################### #### BAYESIAN REGULARISED MODEL FOR MODELLING THE ABUNDANCE AND DETECTION OF ALIEN REPTILES IN cHRISTMAS ISLAND #### #################################################################################################################### ##### NIMBLE code for running the Bayesian regularised model for estimating the abundance and probabilities of individual detection of alien reptiles in Christmas Island. ##### The model was fit independently to the data from each of the five species model.ci<-nimbleCode({ ### Prior distributions for the abundance part of the model ### Priors for the slopes of the abundance model - for running the Bayesian regularisation approach for(i in 1:n.covab){ ### n.covab: number of abundance covariates - 8 in our model beta.ab[i]~dnorm(0, var=s.ab) ### Prior for the slopes in the model } s.ab~dexp(0.5) ### Prior for the variance parameter of the slopes; use of an exponential distribution for obtaining a regularised model r~dunif(0, 50) ### Prior for the overdispersion parameter of the Negative Binomial regression ### Prior distributions for the detection part of the model ### Multivariate Normal priors for the detection intercepts; time of the survey (day and night) - specific intercepts alpha.det[1:2]~dmnorm(alphadet.mean[1:2], prec=tau.day[1:2, 1:2]) for (j in 1:2){ alphadet.mean[j]<-0 } tau.day[1:2,1:2]~dwish(S3.day[1:2, 1:2], 3) ### Priors for the slopes of the detection model - for running the Bayesian regularisation approach for (i in 1:n.covdet){ ### n.covdet: number of covariates in the detection model, n = 4 beta.det[i]~dnorm(0, var=s.det) } s.det~dexp(0.5) ### Prior for the variance parameter of the slopes; use of an exponential distribution for obtaining a regularised model ### Likelihood for the species abundance model for (i in 1:n.sites){ ### n.sites: number of surveying sites; n = 34 log(mu[i])<-beta.ab[1]*dist[i]+beta.ab[2]*tree[i]+beta.ab[3]*bush[i]+beta.ab[4]*grass[i]+beta.ab[5]*rocks[i]+beta.ab[6]*human[i]+beta.ab[7]*length[i]+beta.ab[8]*elev[i] p.nb[i]<-r/(r+mu[i]) abundance[i]~dnbinom(p.nb[i], r) ### Negative Binomial distribution of abundance } ### Likelihood of the species detection model for (i in 1:sample.size){ ### sample.size: number of sites surveyed for alien reptiles by number of repeated survey occasions (n = 204) logit(p[i])<-alpha.det[day[i]]+beta.det[1]*tground[i]+beta.det[2]*t10[i]+beta.det[3]*tunder[i]+beta.det[4]*tair[i] ### Probability of detection count[i]~dbin(p[i], abundance[site[i]]) ### Binomial distribution of the number of individuals recorded in each site during each repeated survey occasion. } })