全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
4088 2
2014-08-31
我用R语言运行OPENBUGS时候无法初始化参数,
LOG里面显示unable to generate initial values for node [0F02D600H] of type GraphT.Mixing,
但是用OPENBUGS单独运行的时候就可以跑出结果,请问大牛们知道这是什么原因吗
二维码

扫码加我 拉你入群

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

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

全部回复
2014-9-5 21:51:12
这个给定起来吧
二维码

扫码加我 拉你入群

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

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

2015-1-12 16:31:33
是不是theta用gen inits就可以了~
     
OPENBUGS的话,是这样的么——
# An example model file is given in:
model.file <- system.file(package = "R2WinBUGS", "model", "schools.txt")
# Let's take a look:
file.show(model.file)
# Some example data (see ?schools for details):
data(schools)
schools
J <- nrow(schools)
y <- schools$estimate
sigma.y <- schools$sd
data <- list ("J", "y", "sigma.y")
inits <- function(){
list(theta = rnorm(J, 0, 100), mu.theta = rnorm(1, 0, 100),
sigma.theta = runif(1, 0, 100))
}
## or alternatively something like:
# inits <- list(
# list(theta = rnorm(J, 0, 90), mu.theta = rnorm(1, 0, 90),
# sigma.theta = runif(1, 0, 90)),
# list(theta = rnorm(J, 0, 100), mu.theta = rnorm(1, 0, 100),
# sigma.theta = runif(1, 0, 100))
# list(theta = rnorm(J, 0, 110), mu.theta = rnorm(1, 0, 110),
# sigma.theta = runif(1, 0, 110)))
parameters <- c("theta", "mu.theta", "sigma.theta")
## Not run:
## both write access in the working directory and package BRugs required:
schools.sim <- bugs(data, inits, parameters, model.file,
n.chains = 3, n.iter = 5000,
program = "openbugs", working.directory = NULL)
print(schools.sim)
plot(schools.sim)
## End(Not run)


二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群