Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
I just wanted to post in conclusion to this thread that I have had success running WinBUGS from R via R2WinBUGS, with the help of Gorjanc, Uwe, and Ben by email outside of this thread. I may have had a permissions problem, that was probably corrected by entering this in the terminal: m...@computer:~$ chmod -R u+w /home/me/.wine/drive_c/Program Files/WinBUGS14/ From here, I opened R, entered library(R2WinBUGS), then ?bugs, then copy/pasted the example, and ran it exactly. My mistake that prevented it all from running was that I started R as sudo R, thinking that would give me more permissions, because I thought I was having permissions-oriented problems. But this is wrong. When I started R by merely entering R in the terminal, the example code ran perfectly. Success! Winepaths did not have to be specified because WinBUGS was installed in the usual place (c:/Program Files/WinBUGS14/). Other people have emailed me, indicating that newer versions of WINE have not worked for them, so I am back with WINE 1.0. I hope this helps others trying to run WinBUGS on Linux. -- View this message in context: http://www.nabble.com/How-to-connect-R-and-WinBUGS-OpenBUGS-LinBUGS-in-Linux-in-Feb.-2009-tp22058716p22136577.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
I do not know about the ubuntu instructions, they would not help me on Suse. The wine version is 1.1.9. I thought that was the latest,but when I checked latest is 1.1.15, which does indeed throw the blackbox error. So, now it does not work for me either Sorry I gave bad advise kees On Thu, 19 Feb 2009 01:38:15 +0100, Paul Heinrich Dietrich paul.heinrich.dietr...@gmail.com wrote: I went to this webpage (http://ubuntuforums.org/showthread.php?t=624644) and followed the instructions to the letter on getting the latest Wine. I installed WinBUGS again, but this time I cannot open it in Wine. It says Black Box, Trap #101, and some text I can't copy/paste here. Is this the latest Wine that you have, or something different? Thanks. chaogai-2 wrote: Hi, For me running winbugs through wine just works. Even when I do not specify any directories. The example they give in the bugs helpfile was my starting point. Setup is suse 11.1, latest Wine, R, R2WinBUGS winbugs. I assume you first tried without specifying directories? The directories you use do not work for me, with WINEPATH the culprit. If you do not have the latest wine I advise to upgrade not specify directories. Good luck, Kees On Wed, 18 Feb 2009 01:27:18 +0100, Paul Heinrich Dietrich paul.heinrich.dietr...@gmail.com wrote: Hi Uwe, Thank you for your guidance. I have installed R2WinBUGS and WinBUGS14 under wine. Using ?bugs for help, it tells me: useWINE: logical; attempt to use the Wine emulator to run 'WinBUGS', defaults to 'FALSE' on Windows, and 'TRUE' otherwise. Not available in S-PLUS. WINE: character, path to 'wine' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. newWINE: Use new versions of Wine that have 'winepath' utility WINEPATH: character, path to 'winepath' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. ..and the following code is a simple Bayesian version of a t-test... Directory Paths MyModelPath - /home/me/Compound/R/WinBUGS/ MyBUGSPath - /home/me/.wine/drive_c/Program Files/WinBUGS14/ MyModelFile - paste(MyModelPath, model.bug, sep=) WINEPATH - /usr/bin/wine Create Data Set # Here is some fake data n_draws - 50 x - round(runif(n_draws, 1, 2)) y - ifelse(x == 1, rnorm(n_draws, 1, 1), rnorm(n_draws, 1.2, 0.8)) MyData - as.data.frame(cbind(y, x)) y.n - NROW(MyData$y) x.j - length(unique(x)) summary(MyData) ## Format Data for WinBUGS ## MyBUGSData - list(y=MyData$y, x=MyData$x, n=y.n, x.j=x.j) MyBUGSData ## WinBUGS Model File ### library(R2WinBUGS) cat(model { for (i in 1:n) { y[i] ~ dnorm(mu[i], tau) mu[i] - alpha + beta[x[i]] } ### STZ (Sum-To-Zero) Constraints beta[1] - -sum(beta[2:x.j]) ### Priors alpha ~ dnorm(0.0, 1.0E-4) for (i in 2:x.j) { beta[i] ~ dnorm(0.0, 1.0E-4) } tau ~ dgamma(0.01, 0.01) precision - sqrt(1/tau) }, file=MyModelFile) file.show(MyModelFile) # WinBUGS Model # MyModel - bugs(MyBUGSData, inits=NULL, model.file=MyModelFile, parameters.to.save=c(alpha, beta, precision), n.chains=3, n.iter=2000, n.burnin=1000, n.thin=1, codaPkg=TRUE, bugs.directory = MyBUGSPath, working.directory=MyModelPath, useWINE=TRUE, WINEPATH=WINEPATH, debug=TRUE) The output says: ERROR: cannot open the connection I'm wondering if I've misinterpreted how to set my paths with wine, because I can go to the following path, double-click on WinBUGS14.exe, and open it just fine: /home/me/.wine/drive_c/Program Files/WinBUGS14/ I can also go to Applications Wine Browse C:\ Drive and navigate to WinBUGS. Please help if I've done something wrong. Thanks. -- __ R-help@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. -- __ R-help@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.
Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
Hi Kees, No harm no foul. I'm glad you posted that anyway, because now anyone who's trying to do the same thing and read this will know to seek your 1.1.9 version and stay away from 1.1.15. Paul chaogai-2 wrote: I do not know about the ubuntu instructions, they would not help me on Suse. The wine version is 1.1.9. I thought that was the latest,but when I checked latest is 1.1.15, which does indeed throw the blackbox error. So, now it does not work for me either Sorry I gave bad advise kees On Thu, 19 Feb 2009 01:38:15 +0100, Paul Heinrich Dietrich paul.heinrich.dietr...@gmail.com wrote: I went to this webpage (http://ubuntuforums.org/showthread.php?t=624644) and followed the instructions to the letter on getting the latest Wine. I installed WinBUGS again, but this time I cannot open it in Wine. It says Black Box, Trap #101, and some text I can't copy/paste here. Is this the latest Wine that you have, or something different? Thanks. chaogai-2 wrote: Hi, For me running winbugs through wine just works. Even when I do not specify any directories. The example they give in the bugs helpfile was my starting point. Setup is suse 11.1, latest Wine, R, R2WinBUGS winbugs. I assume you first tried without specifying directories? The directories you use do not work for me, with WINEPATH the culprit. If you do not have the latest wine I advise to upgrade not specify directories. Good luck, Kees On Wed, 18 Feb 2009 01:27:18 +0100, Paul Heinrich Dietrich paul.heinrich.dietr...@gmail.com wrote: Hi Uwe, Thank you for your guidance. I have installed R2WinBUGS and WinBUGS14 under wine. Using ?bugs for help, it tells me: useWINE: logical; attempt to use the Wine emulator to run 'WinBUGS', defaults to 'FALSE' on Windows, and 'TRUE' otherwise. Not available in S-PLUS. WINE: character, path to 'wine' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. newWINE: Use new versions of Wine that have 'winepath' utility WINEPATH: character, path to 'winepath' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. ..and the following code is a simple Bayesian version of a t-test... Directory Paths MyModelPath - /home/me/Compound/R/WinBUGS/ MyBUGSPath - /home/me/.wine/drive_c/Program Files/WinBUGS14/ MyModelFile - paste(MyModelPath, model.bug, sep=) WINEPATH - /usr/bin/wine Create Data Set # Here is some fake data n_draws - 50 x - round(runif(n_draws, 1, 2)) y - ifelse(x == 1, rnorm(n_draws, 1, 1), rnorm(n_draws, 1.2, 0.8)) MyData - as.data.frame(cbind(y, x)) y.n - NROW(MyData$y) x.j - length(unique(x)) summary(MyData) ## Format Data for WinBUGS ## MyBUGSData - list(y=MyData$y, x=MyData$x, n=y.n, x.j=x.j) MyBUGSData ## WinBUGS Model File ### library(R2WinBUGS) cat(model { for (i in 1:n) { y[i] ~ dnorm(mu[i], tau) mu[i] - alpha + beta[x[i]] } ### STZ (Sum-To-Zero) Constraints beta[1] - -sum(beta[2:x.j]) ### Priors alpha ~ dnorm(0.0, 1.0E-4) for (i in 2:x.j) { beta[i] ~ dnorm(0.0, 1.0E-4) } tau ~ dgamma(0.01, 0.01) precision - sqrt(1/tau) }, file=MyModelFile) file.show(MyModelFile) # WinBUGS Model # MyModel - bugs(MyBUGSData, inits=NULL, model.file=MyModelFile, parameters.to.save=c(alpha, beta, precision), n.chains=3, n.iter=2000, n.burnin=1000, n.thin=1, codaPkg=TRUE, bugs.directory = MyBUGSPath, working.directory=MyModelPath, useWINE=TRUE, WINEPATH=WINEPATH, debug=TRUE) The output says: ERROR: cannot open the connection I'm wondering if I've misinterpreted how to set my paths with wine, because I can go to the following path, double-click on WinBUGS14.exe, and open it just fine: /home/me/.wine/drive_c/Program Files/WinBUGS14/ I can also go to Applications Wine Browse C:\ Drive and navigate to WinBUGS. Please help if I've done something wrong. Thanks. -- __ R-help@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. -- __ R-help@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. -- View this
Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
Hi, For me running winbugs through wine just works. Even when I do not specify any directories. The example they give in the bugs helpfile was my starting point. Setup is suse 11.1, latest Wine, R, R2WinBUGS winbugs. I assume you first tried without specifying directories? The directories you use do not work for me, with WINEPATH the culprit. If you do not have the latest wine I advise to upgrade not specify directories. Good luck, Kees On Wed, 18 Feb 2009 01:27:18 +0100, Paul Heinrich Dietrich paul.heinrich.dietr...@gmail.com wrote: Hi Uwe, Thank you for your guidance. I have installed R2WinBUGS and WinBUGS14 under wine. Using ?bugs for help, it tells me: useWINE: logical; attempt to use the Wine emulator to run 'WinBUGS', defaults to 'FALSE' on Windows, and 'TRUE' otherwise. Not available in S-PLUS. WINE: character, path to 'wine' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. newWINE: Use new versions of Wine that have 'winepath' utility WINEPATH: character, path to 'winepath' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. ..and the following code is a simple Bayesian version of a t-test... Directory Paths MyModelPath - /home/me/Compound/R/WinBUGS/ MyBUGSPath - /home/me/.wine/drive_c/Program Files/WinBUGS14/ MyModelFile - paste(MyModelPath, model.bug, sep=) WINEPATH - /usr/bin/wine Create Data Set # Here is some fake data n_draws - 50 x - round(runif(n_draws, 1, 2)) y - ifelse(x == 1, rnorm(n_draws, 1, 1), rnorm(n_draws, 1.2, 0.8)) MyData - as.data.frame(cbind(y, x)) y.n - NROW(MyData$y) x.j - length(unique(x)) summary(MyData) ## Format Data for WinBUGS ## MyBUGSData - list(y=MyData$y, x=MyData$x, n=y.n, x.j=x.j) MyBUGSData ## WinBUGS Model File ### library(R2WinBUGS) cat(model { for (i in 1:n) { y[i] ~ dnorm(mu[i], tau) mu[i] - alpha + beta[x[i]] } ### STZ (Sum-To-Zero) Constraints beta[1] - -sum(beta[2:x.j]) ### Priors alpha ~ dnorm(0.0, 1.0E-4) for (i in 2:x.j) { beta[i] ~ dnorm(0.0, 1.0E-4) } tau ~ dgamma(0.01, 0.01) precision - sqrt(1/tau) }, file=MyModelFile) file.show(MyModelFile) # WinBUGS Model # MyModel - bugs(MyBUGSData, inits=NULL, model.file=MyModelFile, parameters.to.save=c(alpha, beta, precision), n.chains=3, n.iter=2000, n.burnin=1000, n.thin=1, codaPkg=TRUE, bugs.directory = MyBUGSPath, working.directory=MyModelPath, useWINE=TRUE, WINEPATH=WINEPATH, debug=TRUE) The output says: ERROR: cannot open the connection I'm wondering if I've misinterpreted how to set my paths with wine, because I can go to the following path, double-click on WinBUGS14.exe, and open it just fine: /home/me/.wine/drive_c/Program Files/WinBUGS14/ I can also go to Applications Wine Browse C:\ Drive and navigate to WinBUGS. Please help if I've done something wrong. Thanks. -- __ R-help@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.
Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
Uwe Ligges wrote: Hi all, I've managed to get JAGS working on my Ubuntu Hardy Linux with a 32-bit computer and AMD processors using R 2.8.1. JAGS is great. I've read that JAGS is the fastest, but that hasn't been my experience. At any rate, I have more experience with WinBUGS under Windows and would like a version of that working as well. It seems like I've read a lot on the subject and tried a lot, but haven't managed to get BUGS to work yet. The most success I've had is to install WinBUGS or OpenBUGS using this method: http://www.math.aau.dk/~slb/kurser/bayes-08/install.html What you also need to know is that you need to open Wine and add a drive. Although Z is recommended, I haven't been able to specify it, but have gotten a D drive to work, using: wine D:/opt/OpenBUGS/winbugs.exe Using this method, OpenBUGS opens. Now, to be able to open it with R. I've read all sorts of discussions about BRugs (which is no longer on CRAN, but old versions can still be found), rbugs, and R2WinBUGS (which I'm used to using on Windows with WinBUGS). Some people say R2WinBUGS cannot run OpenBUGS on Linux, some claim they've done it (I think). It seems the same thing with everything else. I've tried making the linbugs and cbugs file recommended elsewhere online. It's all very confusing. For short: It is quite unlikely that BRugs / OpenBUGS (which is called LinBUGS under Linux) works natively under your Linux (although it might work under very specific settings). As every now and then I get offline requests from people who stumble on this thread http://finzi.psych.upenn.edu/R/Rhelp08/archive/132855.html to give details on how I got OpenBUGS running under GNU/Linux, I made a stripped-down package that does just that. The approach is very, very basic and I only tested this on a few machines and distributions, but if it can be useful to anyone, I temporarily put it up at http://www.openanalytics.be/rOpenBUGS_0.0-1.tar.gz Best, Tobias __ R-help@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.
Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
Tobias, this looks great! I'm new to Linux, and I've only installed packages from within R with install.packages(). I'm guessing that I should unzip ROpenBUGS to the following path: /usr/local/lib/R/site-library/ ...just checking because I'm new and don't want to do it wrong. Thanks. PS This really looks great. Any thought to making this a permanently available package on CRAN? Tobias Verbeke-4 wrote: Uwe Ligges wrote: Hi all, I've managed to get JAGS working on my Ubuntu Hardy Linux with a 32-bit computer and AMD processors using R 2.8.1. JAGS is great. I've read that JAGS is the fastest, but that hasn't been my experience. At any rate, I have more experience with WinBUGS under Windows and would like a version of that working as well. It seems like I've read a lot on the subject and tried a lot, but haven't managed to get BUGS to work yet. The most success I've had is to install WinBUGS or OpenBUGS using this method: http://www.math.aau.dk/~slb/kurser/bayes-08/install.html What you also need to know is that you need to open Wine and add a drive. Although Z is recommended, I haven't been able to specify it, but have gotten a D drive to work, using: wine D:/opt/OpenBUGS/winbugs.exe Using this method, OpenBUGS opens. Now, to be able to open it with R. I've read all sorts of discussions about BRugs (which is no longer on CRAN, but old versions can still be found), rbugs, and R2WinBUGS (which I'm used to using on Windows with WinBUGS). Some people say R2WinBUGS cannot run OpenBUGS on Linux, some claim they've done it (I think). It seems the same thing with everything else. I've tried making the linbugs and cbugs file recommended elsewhere online. It's all very confusing. For short: It is quite unlikely that BRugs / OpenBUGS (which is called LinBUGS under Linux) works natively under your Linux (although it might work under very specific settings). As every now and then I get offline requests from people who stumble on this thread http://finzi.psych.upenn.edu/R/Rhelp08/archive/132855.html to give details on how I got OpenBUGS running under GNU/Linux, I made a stripped-down package that does just that. The approach is very, very basic and I only tested this on a few machines and distributions, but if it can be useful to anyone, I temporarily put it up at http://www.openanalytics.be/rOpenBUGS_0.0-1.tar.gz Best, Tobias __ R-help@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. -- View this message in context: http://www.nabble.com/How-to-connect-R-and-WinBUGS-OpenBUGS-LinBUGS-in-Linux-in-Feb.-2009-tp22058716p22091812.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
I went to this webpage (http://ubuntuforums.org/showthread.php?t=624644) and followed the instructions to the letter on getting the latest Wine. I installed WinBUGS again, but this time I cannot open it in Wine. It says Black Box, Trap #101, and some text I can't copy/paste here. Is this the latest Wine that you have, or something different? Thanks. chaogai-2 wrote: Hi, For me running winbugs through wine just works. Even when I do not specify any directories. The example they give in the bugs helpfile was my starting point. Setup is suse 11.1, latest Wine, R, R2WinBUGS winbugs. I assume you first tried without specifying directories? The directories you use do not work for me, with WINEPATH the culprit. If you do not have the latest wine I advise to upgrade not specify directories. Good luck, Kees On Wed, 18 Feb 2009 01:27:18 +0100, Paul Heinrich Dietrich paul.heinrich.dietr...@gmail.com wrote: Hi Uwe, Thank you for your guidance. I have installed R2WinBUGS and WinBUGS14 under wine. Using ?bugs for help, it tells me: useWINE: logical; attempt to use the Wine emulator to run 'WinBUGS', defaults to 'FALSE' on Windows, and 'TRUE' otherwise. Not available in S-PLUS. WINE: character, path to 'wine' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. newWINE: Use new versions of Wine that have 'winepath' utility WINEPATH: character, path to 'winepath' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. ..and the following code is a simple Bayesian version of a t-test... Directory Paths MyModelPath - /home/me/Compound/R/WinBUGS/ MyBUGSPath - /home/me/.wine/drive_c/Program Files/WinBUGS14/ MyModelFile - paste(MyModelPath, model.bug, sep=) WINEPATH - /usr/bin/wine Create Data Set # Here is some fake data n_draws - 50 x - round(runif(n_draws, 1, 2)) y - ifelse(x == 1, rnorm(n_draws, 1, 1), rnorm(n_draws, 1.2, 0.8)) MyData - as.data.frame(cbind(y, x)) y.n - NROW(MyData$y) x.j - length(unique(x)) summary(MyData) ## Format Data for WinBUGS ## MyBUGSData - list(y=MyData$y, x=MyData$x, n=y.n, x.j=x.j) MyBUGSData ## WinBUGS Model File ### library(R2WinBUGS) cat(model { for (i in 1:n) { y[i] ~ dnorm(mu[i], tau) mu[i] - alpha + beta[x[i]] } ### STZ (Sum-To-Zero) Constraints beta[1] - -sum(beta[2:x.j]) ### Priors alpha ~ dnorm(0.0, 1.0E-4) for (i in 2:x.j) { beta[i] ~ dnorm(0.0, 1.0E-4) } tau ~ dgamma(0.01, 0.01) precision - sqrt(1/tau) }, file=MyModelFile) file.show(MyModelFile) # WinBUGS Model # MyModel - bugs(MyBUGSData, inits=NULL, model.file=MyModelFile, parameters.to.save=c(alpha, beta, precision), n.chains=3, n.iter=2000, n.burnin=1000, n.thin=1, codaPkg=TRUE, bugs.directory = MyBUGSPath, working.directory=MyModelPath, useWINE=TRUE, WINEPATH=WINEPATH, debug=TRUE) The output says: ERROR: cannot open the connection I'm wondering if I've misinterpreted how to set my paths with wine, because I can go to the following path, double-click on WinBUGS14.exe, and open it just fine: /home/me/.wine/drive_c/Program Files/WinBUGS14/ I can also go to Applications Wine Browse C:\ Drive and navigate to WinBUGS. Please help if I've done something wrong. Thanks. -- __ R-help@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. -- View this message in context: http://www.nabble.com/How-to-connect-R-and-WinBUGS-OpenBUGS-LinBUGS-in-Linux-in-Feb.-2009-tp22058716p22091675.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
Paul Heinrich Dietrich wrote: Hi all, I've managed to get JAGS working on my Ubuntu Hardy Linux with a 32-bit computer and AMD processors using R 2.8.1. JAGS is great. I've read that JAGS is the fastest, but that hasn't been my experience. At any rate, I have more experience with WinBUGS under Windows and would like a version of that working as well. It seems like I've read a lot on the subject and tried a lot, but haven't managed to get BUGS to work yet. The most success I've had is to install WinBUGS or OpenBUGS using this method: http://www.math.aau.dk/~slb/kurser/bayes-08/install.html What you also need to know is that you need to open Wine and add a drive. Although Z is recommended, I haven't been able to specify it, but have gotten a D drive to work, using: wine D:/opt/OpenBUGS/winbugs.exe Using this method, OpenBUGS opens. Now, to be able to open it with R. I've read all sorts of discussions about BRugs (which is no longer on CRAN, but old versions can still be found), rbugs, and R2WinBUGS (which I'm used to using on Windows with WinBUGS). Some people say R2WinBUGS cannot run OpenBUGS on Linux, some claim they've done it (I think). It seems the same thing with everything else. I've tried making the linbugs and cbugs file recommended elsewhere online. It's all very confusing. For short: It is quite unlikely that BRugs / OpenBUGS (which is called LinBUGS under Linux) works natively under your Linux (although it might work under very specific settings). BRugs is available for Windows users from the CRAN extras repsository maintained by Brian Ripley. We moved it in order to meet GPL compliance issues. Hence a standard recommendation is to use R2WinBUGS under native R under Linux with WinBUGS running under wine. R2WinBUGS can use wine to do so. See the help page ?bugs once you have loaded R2WinBUGS. Best wishes, Uwe Ligges Can someone show a method that works currently, along with some sample code? I'm also new to Linux, and confused by path conventions. For example, in rbugs, it shows an example of a path such as /var/scratch/jyan/wine-20040408/wine, and I don't see how to modify this. I have no /var/scratch to begin with, and think Wine is installed in /home/me/.wine...(I don't have Linux in front of me right now). Please help. Thanks. __ R-help@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.
Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
Hi Uwe, Thank you for your guidance. I have installed R2WinBUGS and WinBUGS14 under wine. Using ?bugs for help, it tells me: useWINE: logical; attempt to use the Wine emulator to run 'WinBUGS', defaults to 'FALSE' on Windows, and 'TRUE' otherwise. Not available in S-PLUS. WINE: character, path to 'wine' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. newWINE: Use new versions of Wine that have 'winepath' utility WINEPATH: character, path to 'winepath' binary file, it is tried hard (by a guess and the utilities 'which' and 'locate') to get the information automatically if not given. ..and the following code is a simple Bayesian version of a t-test... Directory Paths MyModelPath - /home/me/Compound/R/WinBUGS/ MyBUGSPath - /home/me/.wine/drive_c/Program Files/WinBUGS14/ MyModelFile - paste(MyModelPath, model.bug, sep=) WINEPATH - /usr/bin/wine Create Data Set # Here is some fake data n_draws - 50 x - round(runif(n_draws, 1, 2)) y - ifelse(x == 1, rnorm(n_draws, 1, 1), rnorm(n_draws, 1.2, 0.8)) MyData - as.data.frame(cbind(y, x)) y.n - NROW(MyData$y) x.j - length(unique(x)) summary(MyData) ## Format Data for WinBUGS ## MyBUGSData - list(y=MyData$y, x=MyData$x, n=y.n, x.j=x.j) MyBUGSData ## WinBUGS Model File ### library(R2WinBUGS) cat(model { for (i in 1:n) { y[i] ~ dnorm(mu[i], tau) mu[i] - alpha + beta[x[i]] } ### STZ (Sum-To-Zero) Constraints beta[1] - -sum(beta[2:x.j]) ### Priors alpha ~ dnorm(0.0, 1.0E-4) for (i in 2:x.j) { beta[i] ~ dnorm(0.0, 1.0E-4) } tau ~ dgamma(0.01, 0.01) precision - sqrt(1/tau) }, file=MyModelFile) file.show(MyModelFile) # WinBUGS Model # MyModel - bugs(MyBUGSData, inits=NULL, model.file=MyModelFile, parameters.to.save=c(alpha, beta, precision), n.chains=3, n.iter=2000, n.burnin=1000, n.thin=1, codaPkg=TRUE, bugs.directory = MyBUGSPath, working.directory=MyModelPath, useWINE=TRUE, WINEPATH=WINEPATH, debug=TRUE) The output says: ERROR: cannot open the connection I'm wondering if I've misinterpreted how to set my paths with wine, because I can go to the following path, double-click on WinBUGS14.exe, and open it just fine: /home/me/.wine/drive_c/Program Files/WinBUGS14/ I can also go to Applications Wine Browse C:\ Drive and navigate to WinBUGS. Please help if I've done something wrong. Thanks. -- View this message in context: http://www.nabble.com/How-to-connect-R-and-WinBUGS-OpenBUGS-LinBUGS-in-Linux-in-Feb.-2009-tp22058716p22069602.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.