On 14-02-03 8:26 PM, Katharine Walter wrote:
> Hi,
> I am having a problem adding an additional level to my hierarchical
> model. I have just added a level dif[i] and am getting "multiple
> definitions of node dif[i]". I would like to define dif[i] as a
> function of local environemental covariates for grid cell i, but don't
> want to redefine it in my second loop. Any ideas?
The problem is that you are defining it as a computed node,
dif[i]<-C0 + C1*env1[i]
and also giving it a prior,
dif[j] ~ dgamma(1,1)
You can't do both of those things. You put priors on C0 and C1, so
those will imply a prior on dif[i], assuming that env1[i] is defined
elsewhere.
Duncan Murdoch
>
> Thank you for your hlep!
>
>
> model {
>
> for (i in 1:nn){
> y[index[i]] ~ dbin(p[index[i]],1)
> p.bound[index[i]] <- max(0,min(1,p[index[i]]))
> logit(p[index[i]]) <- u[index[i]] + log(N[index[i]+1])
> u[index[i]] <- y[index[i]]*(1-4*dif[i]) + u1[index[i]]*dif[i] +
> u2[index[i]]*dif[i] + u3[index[i]]*dif[i] + u4[index[i]]*dif[i]
> dif[i]<-C0 + C1*env1[i]
>
>
> for (t in 1:(tt[i]-1)){
>
> y[index[i]+t] ~ dbin(p[index[i]+t],1)
> p.bound[index[i]+t] <- max(0,min(1,p[index[i]+t]))
> logit(p[index[i]+t]) <- u[index[i]+t] + log(N[index[i]+t]+1)
> u[index[i]+t] <- y[index[i]+t-1]*(1-4*dif[i]) + u1[index[i]+t-1]*dif[i]
> + u2[index[i]+t-1]*dif[i] + u3[index[i]+t-1]*dif[i] +
> u4[index[i]+t-1]*dif[i]
>
> }
> }
>
>
> #PRIOR
> for (j in 1:nn) { dif[j] ~ dgamma(1,1) }
> C0~dnorm(0, 1)
> C1~dnorm(0, 1)
>
> }
>
>
> ------------------------------------------------------------------- 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]
> <mailto:[log in to unmask]> To mail the BUGS list, mail to
> [log in to unmask] <mailto:[log in to unmask]> Before mailing, please
> check the archive at www.jiscmail.ac.uk/lists/bugs.html
> <http://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] <mailto:[log in to unmask]> If this fails,
> mail [log in to unmask] <mailto:[log in to unmask]>,
> NOT the whole list
-------------------------------------------------------------------
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
|