How do I identify this trap error in WinBUGS? I am currently working on my thesis and interested in estimating a Weibull conditional Hazard Frailty Model for recurrent event data using WinBUGS. I wrote the model but when am trying to use it with the following script it hangs unexpectedly. It returns a messages titled "undefined real result". What am I doing wrong? Also, I have tried different prior and initial values but I could not solve the problem!
model
{
for(i in 1:633){
ht[i]<-gama*pow((t[i]),(gama-1))*exp(age[i]*b[1]+sex[i]*b[2]+mar[i]*b[3]+back1[i]*b[4]+back2[i]*b[5]+form[i]*b[6]+u[subject[i]]+delta*enu[i])
}
for(i in 1:633){
beta[i]<-pow((1/gama),((gama*pow((t[i]),(gama-1)))/ht[i]))
}
for(i in 1:633){
t[i]~dweib(gama,beta[i]) I(cen[i],)
}
for (j in 1:6){
b[j]~dnorm(0,0.001)
}
for(i in 1:159){
u[i]~dnorm(0,tau)
}
delta~dnorm(0,0.01)
gama~dgamma(1,0.01)
tau~dunif(0,100)
sigma2.subject<-1/tau
}
list(b=c(0,0,0,0,0,0),gama=1,tau=1,delta=0)

I would appreciate it if you could help me for solving this problem.
 A: This is most likely due to numerical overflow, which is also stated in this troubleshooting guide for Bugs.

'undefined real result' indicates numerical overflow. Possible reasons include:
   - initial values generated from a 'vague' prior distribution may be numerically extreme - specify appropriate initial values;
   - numerically impossible values such as log of a non-positive number - check, for example, that no zero expectations have been given when Poisson modelling;
   - numerical difficulties in sampling. Possible solutions include:
   - better initial values;
   - more informative priors - uniform priors might still be used but with their range restricted to plausible values;
   - better parameterisation to improve orthogonality;
   - standardisation of covariates to have mean 0 and standard deviation 1.
   - can happen if all initial values are equal.  

So there are a number of different things to consider, and we cannot evaluate problems in your data. Since you have tried different initial values this can maybe be ruled out. I would suggest that you look closely at your data and maybe try to standardise variables.
Have you checked the data for problems? For instance, you are using beta[i] as a parameter in the Weibull distribution, and from what I know this must be >0. If any value in beta[i] is zero this might cause this error.
In your model, one if the definitions is t[i]~dweib(gama,beta[i]) I(cen[i],), which looks a bit strange and is probably a typo. What is I(cen[i],) defining? It shouldn't be the reason for this particular error though.
