R2winbugs : vectorization
Philip, If you are using WinBUGS 1.4, then the poor performance of the inprod function is a known problem. An "inprod2" function was introduced in 1.4.3 to improve performance. See http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/contents.shtml#problems You might try using that. For WinBUGS problems, you should probably try the BUGS mailing list before this one: http://www.jiscmail.ac.uk/lists/bugs.html Martyn Quoting Ben Bolker <bolker at ufl.edu>:
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]
print(bugs.object,digits=5) 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.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}