1
$\begingroup$

I wrote this code in WinBUGS but I can't run it! It says 'multiple definitions of node tau'

model
{for(i in 1:N) {IQ[i]~dnorm(mu,tau)}
mu~dnorm(90,tau.mu)
tau~dgamma(35.64,5022.8)
sigma2.mu<-sigma2/22
tau.mu<-1/sigma2.mu
tau<-1/sigma2
}
#Initial values
list(mu=0,tau=1)
#Data
list(N=4, IQ=c(96,98,77,66))

Can someone help me find the mistake?

$\endgroup$
2
$\begingroup$

Can someone help me find the mistake?

You define tau twice, once as a random variable, and once as the inverse of sigma2:

tau~dgamma(35.64,5022.8)
tau<-1/sigma2
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.