[R] WinBUGS14 and R
Uwe Ligges
ligges at statistik.uni-dortmund.de
Sun Dec 10 16:12:50 CET 2006
Try to use paths without blanks in it.
If that does not work, please provide some reproducible example (e.g., I
do not have "abs.4diff").
BTW: "(is greyed out)" means cannot be used now (buttons appear greyed
out in the GUI). Hence the error happened before (in the check line).
Uwe Ligges
Chris Linton wrote:
> I'm trying to call BUGS from R. But it's not working. R freezes up and
> BUGS gives me a strange output in the log. Just to know, BUGS is
> registered. The modified date on the keys file is today (Dec. 9th). It
> should be fully registered so that I can use it fully. And, the BUGS model
> is syntactically correct. Any suggestions would be very helpful.
>
> Here is my BUGS model:
> model {
> for (i in 1:n){
> y[i] ~ dnorm (y.hat[i], tau.y)
> y.hat[i] <- a[county[i]] + b[county[i]]*x[i]
> }
>
> for (j in 1:J){
> a[j] ~ dnorm (0, .0001)
> b[j] ~ dnorm (b.hat, tau.b)
> }
>
> b.hat ~ dnorm (0, .0001)
> tau.b <- pow(sigma.b, -2)
> sigma.b ~ dnorm (0, 100)
> tau.y <- pow(sigma.y, -2)
> sigma.y ~ dunif (0, 100)
> }
>
>
> Here is my R code used to call BUGS:
> y <- abs.4diff
> n <- length(abs.4diff)
> x <- log.ineq
>
> uniq.name <- unique(country_name)
> J <- length(uniq.name)
> country <- rep (NA, J)
> for (i in 1:J){
> country[country_name==uniq.name[i]] <- i
> }
>
> ineq.bugs <- list ("n", "J", "y", "country", "x")
> ineq.inits <- function (){
> list(a=rnorm(J), b=rnorm(J), b.hat=rnorm(1), sigma.y=runif(1),
> sigma.b=runif(1))}
> ineq.parameters <- c("a", "b", "b.hat", "sigma.y", "sigma.b")
>
> ineq1 <- bugs (ineq.bugs, ineq.inits, ineq.parameters, "C:/Documents and
> Settings/Chris/Desktop/4330/attempt2.bug", n.chains=3, n.iter=10,
> debug=TRUE)
>
>
>
> After I run the R code, R will crash and WinBUGS14 will post this in the
> log:
>
> display(log)
> check(C:/Documents and Settings/Chris/Desktop/4330/attempt2.txt)
> expected left pointing arrow <- or twiddles ~
> data(C:/Documents and Settings/Chris/data.txt)
> command #Bugs:data cannot be executed (is greyed out)
> compile(3)
> inits(1,C:/Documents and Settings/Chris/inits1.txt)
> command #Bugs:inits cannot be executed (is greyed out)
> inits(2,C:/Documents and Settings/Chris/inits2.txt)
> command #Bugs:inits cannot be executed (is greyed out)
> inits(3,C:/Documents and Settings/Chris/inits3.txt)
> command #Bugs:inits cannot be executed (is greyed out)
> gen.inits()
> command #Bugs:gen.inits cannot be executed (is greyed out)
> thin.updater(1)
> update(5)
> command #Bugs:update cannot be executed (is greyed out)
> set(a)
> command #Bugs:set cannot be executed (is greyed out)
> set(b)
> command #Bugs:set cannot be executed (is greyed out)
> set(b.hat)
> command #Bugs:set cannot be executed (is greyed out)
> set(sigma.y)
> command #Bugs:set cannot be executed (is greyed out)
> set(sigma.b)
> command #Bugs:set cannot be executed (is greyed out)
> set(deviance)
> command #Bugs:set cannot be executed (is greyed out)
> dic.set()
> command #Bugs:dic.set cannot be executed (is greyed out)
> update(5)
> command #Bugs:update cannot be executed (is greyed out)
> coda(*,C:/Documents and Settings/Chris/coda)
> command #Bugs:coda cannot be executed (is greyed out)
> stats(*)
> command #Bugs:stats cannot be executed (is greyed out)
> dic.stats()
>
> DIC
> history(*,C:/Documents and Settings/Chris/history.odc)
> command #Bugs:history cannot be executed (is greyed out)
> save(C:/Documents and Settings/Chris/log.odc)
> save(C:/Documents and Settings/Chris/log.txt)
>
>
>
> I'm not sure what "(is greyed out)" means. But, BUGS supposed give really
> poor explanations of its errors. So, it could mean anything. Any advice
> will be greatly appreciated.
>
>
> Thank you for your time,
>
> Chris Linton
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
More information about the R-help
mailing list