Hi,
I am having a little trouble getting a poisson-normal mixture HBM (see code below) to converge when my data are sparse. There are two strange things I have found in trying to get the model to converge in these cases:
1) I simulate abundance from a poisson distribution (e.g. N[i]~dpois(expn[i])). Believe it or not, the values of N[i] are not integers. As dpois is a categorical distribution it should produce only integers, and I'm at a loss to understand why this is occurring
2) I simulate the log of fish density at each site i (phi[i]) given estimates of the mean and precision of a normal distribution, and then transform the site-specific estimates to linear space using log(lambda[i])<-phi[i]. I get much better convergence if I use lambda[i]<-exp(phi[i]). I thought these two operations would be equivalent.
Any help would be much appreciated.
Josh Korman, PhD
Ecometric Research
3560 West 22nd Avenue
Vancouver, BC
V6S 1J3 Canada
Tel: 604 737-8314
Fax: 604 737-8324
Cell: 604 790-8314
## PRIORS FOR DETECTION AND ABUNDANCE MODELS##############
#Detection model priors
mu.theta~dbeta(prior[1,1],prior[1,2]) #mean of beta hyper-distribution for detection probability
tau.xi_t<-pow(prior[2,2],-2) #Half-cauchy on sd for theta
xi_t~dnorm(prior[2,1],tau.xi_t)
tau.eta_theta~dgamma(0.5,0.5)
sigma.theta<-abs(xi_t)/sqrt(tau.eta_theta)
tau.theta<-pow(sigma.theta,-2) #back transform to precision (tau)
#Transforming mu and tau into a and b for beta hyper for theta
a<-mu.theta*tau.theta #tau=a+b and mu=a/(a+b) equivalent to mu=a/tau so a=mu*tau
b<-(1-mu.theta)*tau.theta #as tau=a+b, b=tau-a equivalent to b=tau-mu*tau = (1-mu)*tau
#Abundance model priors
for(j in 1:Nreaches) {
mu.phi[j] ~ dnorm(prior[3,1], prior[3,2]) #Normal (mean and precision of normal distribution for log density)
tau.xi[j]<-pow(prior[4,2],-2) #Half-cauchy
xi[j]~dnorm(prior[4,1],tau.xi[j])
tau.eta_phi[j]~dgamma(g[j,1],g[j,2]) #g determines DF for gamma, which influences relative effect of prior
sigma.phi[j]<-abs(xi[j])/sqrt(tau.eta_phi[j])
tau.phi[j] <- pow(sigma.phi[j],-2)
}
## MODEL TO ESTIMATE SITE N'S AND P'S AND HYPER-PARAMETERS####
for (i in 1:Nsites) {
theta[i]~dbeta(a,b) #detection prob for site drawn from hyper-distribution
phi[i] ~ dnorm(mu.phi[ir[i]], tau.phi[ir[i]]) #log-density at site i
#log(lambda[i]) <- phi[i]
lambda[i]<-exp(phi[i])
expn[i]<-lambda[i]*Area[i] #expected number presesnt at site i is simply density * area
N[i] ~ dpois(expn[i]) #Number at site prior to first pass
Catch[i,1] ~ dbin(theta[i], N[i]) #Catch on pass 1 binomailly distributed and depends on theta and population prior to first pass
z[i,1] <- N[i] - Catch[i,1] #Compute z, the population remaining after pass 1
for(j in 2:Npass[i]) {
Catch[i,j] ~ dbin(theta[i], z[i,j-1]) #as above dbin, but with respect to population size prior to pass j
z[i,j] <- N[i] - sum(Catch[i,1:j]) #update number present after this pass
}
}
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|