Re: [R] Making R talk to Win/OpenBUGS in Linux (again)

From: Paul Johnson <>
Date: Fri 05 May 2006 - 13:38:16 EST

Wow! That was quick.

One more thing would make my R2WinBUGS experience more perfect. I wish the "bugs" function explained how the user can write out the model.txt file from within the R code itself, rather than taking the current advice of creating it separately. The process now escribed in "bugs" is:

  1. Write a WinBUGS model in a ASCII file.
  2. Go into R.

I don't know what the best way to create model.txt might be, but this does work, and maybe you have even better examples to show:

myTextExample <- c(" model {

       for (j in 1:J){
         y[j] ~ dnorm (theta[j], tau.y[j])
         theta[j] ~ dnorm (mu.theta, tau.theta)
         tau.y[j] <- pow(sigma.y[j], -2)
       mu.theta ~ dnorm (0.0, 1.0E-6)
       tau.theta <- pow(sigma.theta, -2)
       sigma.theta ~ dunif (0, 1000)


 zz <- file("model.txt","w")

The only dicey part here is that the user might save the model in the wrong directory, but I don't see what prevents that with the current advice in "bugs"

I suggest this because it allows the creation of one file working examples in R2WinBUGS. For the teaching objective, this simplifies things a lot!

So long, and thanks for all the fish


On 5/4/06, Uwe Ligges <> wrote:
> Paul Johnson wrote:
> > Hello, and thanks for the many very rapid responses to my requests for
> > R/WinBUGS conversation.
> >
> > I do not know how to build OpenBUGS in linux, but will snoop around
> > and see if I can't figure out what's wrong with linking R to
> >
> > In the meanwhile...
> >
> > While we are on the linux/bugs topic, can I please ask for a fix in
> > R2WinBUGS? On my system, the script.txt file is written into the
> > WinBUGS directory,where the user does not ordinarily have write
> > permissions. If script.txt could be written with the other temporary
> > files, this would be solved.
> Will be fixed for the next release.
> We should also add some option to disable running bugs.update.settings()
> which really requires write access in the WinBUGS directory.
> Uwe Ligges
> > pj

Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Fri May 05 13:43:45 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 05 May 2006 - 18:10:00 EST.

Mailing list information is available at Please read the posting guide before posting to the list.