Solve:
I have attached a *.odc file that implements the negative binomial
distribution using the ones and Bernoulli trick. It worked for me first
time out of the gate. Data are included (homicide counts with two
predictors) and you should be able to simply open this document in WinBUGS
and run it. The code is pretty obvious - I just did exactly what the
manual instructed and it worked.
When the model is run with flat priors or with normal priors with low
precision, for the included data, the model reproduces the MLE results
based on the parameterization of Venables and Ripley (3rd edition) of the
negative binomial and implemented in their MASS library in S-PLUS. It also
replicates STATA results if the glm is used (not the nbreg procedure),
i.e., (glm y x1 x2, family(nbinomial denominator.var),link(logit)).
Best,
John Sprague
|