2
$\begingroup$

I am trying to run this WinBUGS code to get a prediction for the number of fatalities in 1975

model
{
    for (i in 1:5) {
        fatal[i] ~ dpois(mu[i])
        log( mu[i] ) <- alpha + beta * (year[i]-1970) + log( pop[i] )
        }
        alpha ~ dnorm(0,10000)
        beta  ~ dnorm(0,10000)
}

list(alpha=74.4, beta=-0.03)

year[] fatal[] pop[]
1971 3798 124.07
1972 3590 126.63
1973 3422 130.67
1974 3679 133.03
1975 NA 245
END

I thought I would be able to use load inits for alpha and beta and gen inits for the missing value for fatal[5]. When I tried this a new window pops up with Trap, undefined real result and a long list of codes etc which I haven't included as they run to about 4 pages. I am hoping a more experienced user may be able to let me know what the problem is from the information I have included. I can include the long error message if it would help.

$\endgroup$

1 Answer 1

3
$\begingroup$

I think that error is occurring because your initial values are not compatible with your priors for alpha and beta. Remember that BUGS parametrises the normal distribution in terms of mean and precision and not mean and standard deviation - so you have incredibly informative priors in your model. You probably want something like:

    alpha ~ dnorm(0, 10^-6)
    beta  ~ dnorm(0, 10^-6)

That prior should ensure that the posteriors of alpha and beta are data dominated, and will hopefully also fix the trap error...

$\endgroup$

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.