Skip to content

bugs.R question

This one’s just for the bugs.R users out there . . .

Hui Xie asks,

I have a question on the bugs function you wrote. It is an extremely useful functions for statistician to implement Baysian. Now I am using it for microarray bayesian analysis. One thing that bothered us is that for each analysis Winbugs will be invoked. As you know, in microarray analysis there are usually thousands of genes for seperate analysis which impies the winbugs window will open and close for thousands times. Therefore it is very disirable to turn it off in this situation. I would like to ask you if there is a way in bugs() that can make Winbugs run in the background.

My reply:

You can do this in Openbugs (run bugs() with the version=2 option), however Openbugs is still pretty buggy and is not nearly as reliable as regular Winbugs. Another option is to reconfigure your Bugs model so that it does hundreds or thousands of analyses at once. This should be easy to do just by looping. Finally, I’d like to say you could do it in Umacs (our universal Markov chain sampler) but we’re still working on that program!


  1. Boris S. says:

    I'd like to second Andrew's comment about looping within a WinBugs model. I was previously invoking Bugs.R repeatedly in an R loop (for a Monte Carlo analysis), and it was painfully slow, as the fixed cost of invoking Bugs.R and WinBugs is relatively high. But after putting the loop inside the model, things sped up considerably. But do note that this requires lots of memory …

  2. Hui says:

    Putting the loop inside the model works, and as Boris pointed out, it did speed up. However one consequence is that one would not be able to obtain some statistics, like DIC, for each indiviual loop. We might only be able to obtain DIC for the whole model, i.e. for all the individual analysis together.

  3. Andrew says:


    Yes, you'll just have to compute DIC by postprocessing the simulations, writing a little R script.