[R] R2winbugs : vectorization

Ben Bolker bolker at ufl.edu
Mon Dec 15 21:23:43 CET 2008

Philip A. Viton wrote:
> I'm new to bugs, so please bear with me. Can someone tell me if the 
> following two models are doing the same thing? The reason I ask is 
> that with the same data, the first (based on 4 separate coeffs 
> a1--a4) takes about 50 secs, while the second (based on a vectorized 
> form, a[]) takes about 300. The means are about the same, though 
> R-hat's in the second version are quite a bit better.

The model definitions do seem to be formally equivalent, but BUGS
is a pretty big-ugly-black-box thing, and your timing (and Rhats)
seem to be pretty good evidence that WinBUGS is *not* constructing
the same sampler in both cases.  (Do the posterior distributions agree
once you get to convergence?)

You could try the same model in JAGS (the R2jags package lets
you use the same R code to call it, just substituting "jags()" for
"bugs()" if you wanted to pursue this further. In my limited experience
JAGS is usually slower than WinBUGS but it's a good cross-check.

Philip A. Viton wrote:
> (Also, and completely unrelated: is there any way to get more than 2 
> decimal places in the display of the means?)
> [snip snip snip]


  Ben Bolker

View this message in context: http://www.nabble.com/R2winbugs-%3A-vectorization-tp21019193p21021187.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list