[R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
Paul Heinrich Dietrich
paul.heinrich.dietrich at gmail.com
Thu Feb 19 01:38:15 CET 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.dietrich at 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 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.
>
>
--
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.
More information about the R-help
mailing list