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!

for(i in 1:633){
for(i in 1:633){
for(i in 1:633){
t[i]~dweib(gama,beta[i]) I(cen[i],)
for (j in 1:6){
for(i in 1:159){

I would appreciate it if you could help me for solving this problem.

  • 2
    $\begingroup$ From my experience, this message is displayed when there is a very big (infinity for BUGS) number obtained, e.g. 10e100 or something. In addition, the diffuse gamma prior distribution usually is the cause of this. I would recommend to use uniforma distribution instead of gamma. Also, from my experience, gamma prior is is quite informative, i.e. influences posterior more that uniform. $\endgroup$
    – Tomas
    Feb 3, 2013 at 14:41
  • $\begingroup$ Although this sounds like a software-specific error, as the comment by @Tomas demonstrates, tracking it down will likely require significant statistical experience and reasoning. I vote to keep this one open here on CV. $\endgroup$
    – whuber
    Feb 3, 2013 at 17:47

1 Answer 1


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.

  • $\begingroup$ Your link doesn't work. $\endgroup$
    – Tomas
    Jul 13, 2016 at 10:33
  • 1
    $\begingroup$ I(cen[i],) is WinBUGs' peculiar notation for left-truncation $\endgroup$
    – Nate Pope
    Jun 6, 2017 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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