Hi folks,
I'm new to this list and BUGS - so apologies if this is something quite
basic.
Consider the following code (I am using the WINBUGS 1.2 beta version):
model
{
for(i in 1:N){
temp <- min(A, S[i])
OUT[i] <- min(0,temp)
S[i+1] <- S[i] - OUT[i] + IN[i]
OUTOBS[i] ~ dnorm(OUT[i],tau)
}
S[1] ~ dunif(0,100)
tau ~ dgamma(0.01,0.01)
A ~ dunif(0,200)
}
#data
list(OUT=c(2,2,3,6,7,8,4,3,2),IN=c(0,1,4,5,8,4,3,2,2),N=9)
#initials
list(S[1]=30,tau=1,A=100)
This gives me a compile error saying "multiple definitions of node for OUT
(a scalar may be defined in a loop)". I read the BUGS manual and it seemed
to confirm that as the order of the expressions in the loop is not important
in BUGS, expressions such as the above (involving incrementing some
variable) can not be readily handled.
Is there some trick to get around this problem? Or the only recourse is to
write up a non-BUGS MCMC code?
Thanks for your help.
Ashish
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|