I am trying to fit a hierarchical model using OpenBUGS, with the following code:
model
{
for (i in 1:N) {
for (j in 1:M){
# Survival times bounded below by censoring times:
t[i,j] ~ dweib(r,mu[i,j]) I(cen[i,j],);
mu[i,j] <- b[i]*exp(beta);
}
# Random effects:
b[i] ~dlnorm(mu, tau)
}
# Priors:
beta ~ dnorm(0, 0.001);
tau ~ dgamma(1.0E-3, 1.0E-3);
r~ dgamma(1, 1.0E-3);
sigma2<-1/tau
mu<-(-1)/2*tau
}
But, I get the
error : 'expected a comma'
, and OpenBUGS highlights tausg
in the tau
...
what I am doing wrong.
thanks
You have specified mu in two places - once as
mu[i,j] <- b[i]*exp(beta),
and then later asmu<-(-1)/2*tau
. You need to change the name of one of them.