Hi Bob,
Thanks for your reply.
I have included a simplified example that gets at my multiple definition
problem. Here I want to estimate abundance from two population (N[]) and
assume that each of these estimates comes from a hyper distribution with a
fixed value for tau. The objective is to estimate the overall abundance
(SuperN) as an information weighted average of the two estimates conditional
on the fixed value of tau. This works fine using the uncommented lines
(expu<- and u~dpois) below. Problem is that in my more complex model, N is a
function of other estimated parameters so need to do something like the two
commented-out lines, which won't work in WinBugs because N is defined twice
(as a logical expression and as a stochastic node).
As for as you second point, you say that STAN cannot estimate discrete
parameters. Would N from u~dbin(theta, N) be estimable if you allow N to be
continuous rather than discrete? Or is the order of a binomial (e.g. N in
this example) just not estimable in STAN?
Thanks,
Josh
Example CODE
r, M, and u are data, p,N, and superN are parameters to be estimated.
model
{
mu~dnorm(0,1.0E-6) #hyper prior on log of single
escapement estimate
for (i in 1:2)
{
p[i]~dbeta(1,1) #uninformative prior n p
r[i]~dbin(p[i],M[i]) #binomial likelihood to estimate
capture probability p given recaps (r) and marks release (M)
logN[i]~dnorm(mu,tau) #log N for each population comes
from a common (super) distribution)
N[i]<-exp(logN[i]) #transform
#The following two lines work as expected
expu[i]<-N[i]*p[i] #expected number of unmarked fish
captured on 2nd pass given N and p
u[i]~dpois(expu[i]) #This makes N[i] a stochastic node
which allows HBM to work
#Replacing the previous 2 lines with the following 2 does
not work due to multiple definitions of node N[]
#u[i]~dbin(p[i],N[i])
#N[i]<-u[i]/p[i]
}
SuperN<-exp(mu) #This is the single estimate based
on information across populations
--