2012-03-25 36 views
2

我試圖從R調用WinBUGS,但我一直都不是很成功。從R調用WinBUGS14

我輸入這個代碼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) 

我將不勝感激如果有人能幫助我。我的文件是在相同的

+0

你的文件radon.1.bug的內容是什麼?我認爲這將是問題的關鍵。 – TMS 2012-03-26 12:27:46

回答

2

這些錯誤信息發生在您的錯誤未編譯時。首先嚐試使用WinBUGS,直到您可以啓動並運行該模型。然後保存

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

部分作爲.bug文件。