2

我正在尝试从 R 调用 WinBUGS,但我并不是很成功。

我在 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")

然后,我调用 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 )

我在 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)

如果有人可以帮助我,我将不胜感激。我的文件在同一个

4

1 回答 1

2

当您的错误尚未编译时,会出现这些错误消息。首先尝试在 WinBUGS 中工作,直到您可以启动并运行模型。然后保存

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

部分作为 .bug 文件。

于 2012-06-04T12:17:46.577 回答