2

I'm trying to call WinBUGS from R, but I have not been very successful.

I typed this code in R:

radon.data <- list ("n", "J", "x", "y", "county")
radon.inits <- function (){
  list (a=rnorm(J), b=rnorm(1), mu.a=rnorm(1),
        sigma.y=runif(1), sigma.a=runif(1))
}
radon.parameters <- c ("a", "b", "mu.a", "sigma.y", "sigma.a")

Then, I call WinBUGS:

radon.bugs.1 <- bugs (radon.data, radon.inits, radon.parameters, "radon.1.bug", n.iter=10,
        bugs.directory="C:/Program Files/WinBUGS14", working.directory=NULL, clearWD=TRUE, debug=TRUE )

And I get following error in the WinBUGS:

set(sigma.y)
command #Bugs:set cannot be executed (is greyed out)
set(sigma.a)
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:/Users/Gabriel/AppData/Local/Temp/Rtmpf1rAQa/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:/Users/Gabriel/AppData/Local/Temp/Rtmpf1rAQa/history.odc)
command #Bugs:history cannot be executed (is greyed out)
save(C:/Users/Gabriel/AppData/Local/Temp/Rtmpf1rAQa/log.odc)
save(C:/Users/Gabriel/AppData/Local/Temp/Rtmpf1rAQa/log.txt)

I would appreciate if someone could help me. My files are in the same

Thomas
  • 43,637
  • 12
  • 109
  • 140
  • what is the content of your file radon.1.bug? This will be the key of problems, I think. – Tomas Mar 26 '12 at 12:27

1 Answers1

2

These error messages occur when your bug has not compiled. Try working in WinBUGS first, until you can get the model up and running. Then save the

model{
    ....
    bayesian model
    ....
}

part as the .bug file.

guyabel
  • 8,014
  • 6
  • 57
  • 86