全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
2153 3
2013-01-09
做了好久改了好久还是有问题存在。百度了谷歌都不好用。
哪位仁兄帮帮忙。。。
MODEL:
model {
for ( i in 1:N) {

   y ~ dnorm(mu, tau)
   mu <- b0 + b1*log(x)
   
   }
  tau ~ dgamma(0.001, 0.001)
  b0 ~ dnorm(0, 1.0E-6)
  b1 ~ dnorm(0, 0.00001)
  sigma <- sqrt(1/tau)
}

Code R:
path.bug <- "G:/ej52/"
path.WBs <- "C:/Program Files/WinBUGS14/"
install.packages('R2WinBUGS')
library(R2WinBUGS)
Iter <- 2000
Burn <- 1000
Thin <- 5
Chain <- 2
notes<-c(9.6,7,5,8,8.4,6.4,6.1,9.1,8.8,5.7,8.9,6.1,6.5)
sexe <-c(1,1,1,1,1,1,0,0,0,0,0,0,0)
N<- length(notes)
dades <- list(N=N, y = notes, x1 = sexe)
inicials <- list(list(tau=0.1, b0=100, b1=100),list(tau=100, b0=-100, b1=-100))
parametres <- c("b0", "b1", "sigma")
model<- bugs(dades, inicials, parameters.to.save=parametres,
               model.file=paste(path.bug,"MODELsessio5.bug",sep="")
               , bugs.directory=path.WBs,
               n.iter=(Iter*Thin+Burn),n.burnin=Burn, n.thin=Thin, n.chains=Chain, debug=T, DIC=F
               ,working.directory=getwd())
print(model , digits=2)
summary(modelF)


就一直出现一样的问题
错误于bugs.run(n.burnin, bugs.directory, WINE = WINE, useWINE = useWINE,  :   Look at the log file andtry again with 'debug=TRUE' to figure out what went wrong within Bugs.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-1-9 08:24:31
我也想知道
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-1-9 08:28:00
有没有人有没有人等待解答 解答继续等待解答~~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-1-9 17:10:40
SAVE THE FOLLOWING MODEL IN FILE "MODELsessio5.bug" or "MODELsessio5.txt"
and place in c:\nieveblanca\MODELsessio5.bug
#-----------------------------
复制代码
#-----------------------------

###in R Console
library(R2WinBUGS)
#Data:
x1 = c( 1.0,  1.5,  1.5,  1.5, 2.5,   4.0,  5.0,  5.0,  7.0, 8.0,  8.5,  9.0,  9.5, 9.5,  10.0, 12.0, 12.0, 13.0,
                   13.0, 14.5, 15.5, 15.5, 16.5, 17.0, 22.5, 29.0, 31.5)
y = c(1.80, 1.85, 1.87, 1.77, 2.02, 2.27, 2.15, 2.26, 2.47, 2.19, 2.26, 2.40, 2.39, 2.41, 2.50, 2.32, 2.32, 2.43,
                   2.47, 2.56, 2.65, 2.47, 2.64, 2.56, 2.70, 2.72, 2.57)
N=length(y)


#y <- c(9.6,7,5,8,8.4,6.4,6.1,9.1,8.8,5.7,8.9,6.1,6.5)
#x1 <-c(1,1,1,1,1,1,0,0,0,0,0,0,0)
#N<- length(y)
dades <- list("N", "y", "x1" )
inicials <- list(list(tau=1, b0=0, b1=1))
parametres <- c("b0", "b1", "sigma")
model<- bugs(dades, inicials, parameters.to.save=parametres,
               model.file="MODELsessio5.bug",n.chains=1,n.thin=1,debug=TRUE,DIC=TRUE,
                     n.iter=2000,n.burnin=1000,working.directory = "c:/nieveblanca/",
                     bugs.directory="d:/WinBUGS14/")
               
print(model , digits=4)

Inference for Bugs model at "MODELsessio5.bug", fit using WinBUGS,
1 chains, each with 2000 iterations (first 1000 discarded)
n.sims = 1000 iterations saved
             mean     sd     2.5%      25%      50%      75%    97.5%
b0         1.7608 0.0470   1.6680   1.7317   1.7615   1.7900   1.8490
b1         0.2778 0.0201   0.2385   0.2655   0.2775   0.2903   0.3163
sigma      0.0970 0.0146   0.0729   0.0865   0.0954   0.1055   0.1280
deviance -52.0948 2.7305 -55.2100 -54.1700 -52.7500 -50.8850 -45.1283

DIC info (using the rule, pD = Dbar-Dhat)
pD = 3.1 and DIC = -49.0
DIC is an estimate of expected predictive error (lower deviance is better).
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

分享

扫码加好友,拉您进群