[R] Current state of support for BUGS access for Linux users?

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Jan 18 12:29:52 CET 2006

Andrew Gelman wrote:

> Hi all.  Sorry for any confusion.  At one point, close to a year ago I 
> think, I put in the effort to get the bugs() function in R to work with 
> OpneBUGS.  But at the time, I couldn't get OpenBUGS to do much.  After 
> some effort I got it to work on some simple examples but I couldn't get 
> it to work on some of my other examples (e.g., a mulitlevel logistic 
> regression).  In the meantime, Uwe and Sibylle set up R2WinBUGS.  I 
> still think that BRugs would be improved by an R front-end (basically, 
> the bugs() function adapted to BRugs).  But I haven't tried to get 

Andrew, let me add a few details:

The BRugs equivalent to your bugs() function is called BRugsFit() - it 
runs the whole stuff fo you with one function call. Some plots can be 
produced afterwards with a second call.

For Linux, what we really want is to get the OpenBUGS library (i.e. 
BRugs.so) run in Linux natively. All other stuff are ugly workarounds.

Since it looks not that promising to get a quick solution these days, it 
might make sense to communicate to some WinBUGS/OpenBUGS running under 
wine. Then, R2WinBUGS could be used for WinBUGS 1.4.x under wine and for 
OpenBUGS something similar to
  - communication structure of R2WinBUGS *and*
  - interface to the OpenBUGS command language
is desirable.

In principle, one could look at BRugs and take the relevant information 
originally passed through .C() calls. Instead of calling .C(), print the 
commands into text files and start OpenBUGS so that it processed the 
generated command files. Unfortunately, one cannot run "interactive" 
simulations that way and is limited to the functionality R2WinBUGS 
already provides.

> OpenBUGS working for awhile so I don't know if it currently fits the 
> models I'd like to fit.  It certainly wouldn't be difficult to extend 
> the bugs() fuction to do the appropriate BRugs calls.
> In a different direction, Jouni Kerman wrote a function to take output 
> from chains of iterative simulation--not necessarily from Bugs, they 
> could come from mcmcsamp() or just your own customized Gibbs or 
> Metropolis program--and convert them into bugs objects, which is nice 
> because then you can automatically monitor convergence and look at the 
> inferences using the built-in plot() and print() options in R2WinBUGS.  
> We'll try to put this in R2WinBUGS soon.

In which case one could use the coda package.

> A key part of a bugs object is the way a vector or matrix of parameters 
> with the same name is structured as a vector or matrix, not simply as 
> part of a long vector of parameters (this can be clearly seen in the 
> right half of the plot() output for a hiearchical model fit in Bugs, and 
> also can be seen if you fit a bugs model and then do attach.bugs() and 
> look at simulations of parameter vectors or arrays.

Hope this is the case in all representations of similar objects.

Anyway, among build-in plot facilities, BRugs supports conversion to 
coda's mcmc objects.


> Gregor Gorjanc wrote:
>>Paul Johnson wrote:
>>>Do you mean to say that you have actually made OpenBUGS run with
>>>R2WinBUGS in Linux?
>>No, I did not say this.
>>>Gelman's page seems to state that OpenBUGS support is brought in from
>>>BRugs, which is still Windows-only.
>>Well, Gelman changed his site a bit. Few days (weeks?) ago there was a
>>red text at the top of [1] stating that bugs.R was accomodated to work
>>with OpenBUGS. Since bugs.R was base for R2WinBUGS, I conclude that
>>BRugs was not involved here. Since then Gelman was active with his pages
>>and things changed/improved. I do not know what he has done to handle
>>also OpenBUGS. Perhaps Gelman and R2WinBUGS maintainers could tell us
>>and I hope that upstream (by Gelman) changes will find way into
>>R2WinBUGS package.
>>>>>Re R packages:
>>>>>- R2WinBUGS is compatible with WinBUGS-1.4.x only, its newest version
>>>>>can speak with WinBUGS under wine thanks to user contributions. But it
>>>>>still depends on WinBUGS-1.4.x, hence Windows only (considering wine as
>>>>However Andrew Gelman, has added also support[1] for OpenBUGS so this
>>>>might be also a good news for Linux if wine is used. Changelog can be
>>>>found at [2].

More information about the R-help mailing list