r - 这似乎工作正常但保持 "command #Bugs:gen.inits cannot be executed (is greyed out)"

标签 r winbugs r2winbugs

我正在通过 R2WinBUGS 使用 WinBUGS 做一个简单的回归模型。 结果看起来不错,但是 WinBUGS 一直显示这条线,我不知道为什么:

command #Bugs:gen.inits cannot be executed (is greyed out)

有人有想法吗? 谢谢!

调用WinBUGS的R代码:

# Prepare data
ni = 12 #Nb of tagging year
prL <- c(0.13,0.23,0.28,0.22,0.29,0.25,0.31,0.32,0.32,0.40,0.33,0.35) #Proportion of tag lost
input.tlr <- list(ni=ni,prL=prL)

# Generates intial values for two chains
nbchains = 2
init1 <- list(beta1=runif(1,-1,1),beta2=runif(1,-1,1),tauG=rgamma(1,1,1))
init2 <- list(beta1=runif(1,-1,1),beta2=runif(1,-1,1),tauG=rgamma(1,1,1))
inits <- list(init1,init2)

# Call WinBUGS
parameters <- c("gamma","beta1","beta2","tauG")
out.tlr <- bugs(data=input.tlr, inits=inits, parameters=parameters, "tlr.txt", n.chains=2, n.iter=20000, n.burnin=5000,n.thin=1,debug=TRUE)

WinBUGS 代码为:

model {
###### Tag lost rate model ######
for (i in 1:ni) {
  prL[i] ~ dnorm(gamma[i],tauG)
  gamma[i] <- beta1 * log(i-0.5) + beta2
  }
### Priors
    beta1 ~ dnorm(0,0.001)
    beta2 ~ dnorm(0,0.001)
    tauG ~ dgamma(0.001,0.001)
} # End model

WinBUGS 的输出是:

display(log)
check(C:/Users/AppData/Local/Temp/RtmpG8dxh1/tlr.txt)
model is syntactically correct
data(C:/Users/alebris/AppData/Local/Temp/RtmpG8dxh1/data.txt)
data loaded
compile(2)
model compiled
inits(1,C:/Users/AppData/Local/Temp/RtmpG8dxh1/inits1.txt)
chain initialized but other chain(s) contain uninitialized variables
inits(2,C:/Users/AppData/Local/Temp/RtmpG8dxh1/inits2.txt)
model is initialized
gen.inits()
command #Bugs:gen.inits cannot be executed (is greyed out)
thin.updater(1)
update(5000)
set(gamma)
set(beta1)
set(beta2)
set(tauG)
set(deviance)
dic.set()
update(15000)
coda(*,C:/Users/AppData/Local/Temp/RtmpG8dxh1/coda)
stats(*)

最佳答案

认为这只是因为您自己提供了inits。 winBUGS 命令 gen.inits 用于自动生成 inits,但如果您手动提供 inits,它会“变灰”。所以我认为这没什么好担心的。

关于r - 这似乎工作正常但保持 "command #Bugs:gen.inits cannot be executed (is greyed out)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29175619/

相关文章:

R 中的 R2WinBUGS 错误

r - 从 R 调用 OpenBUGS 时出现 "Collection operator c error"

r - winbugs中节点错误的多重定义

r - 投资组合分析包中的自定义预期返回

r - jags.parallel - 获取错误(名称,环境 = 环境): invalid first argument

r - 错误消息

r - 查找长格式日期之间的差异

algorithm - R比较所有列表元素的重复项

r - 'rbind' 列名称中具有不同前缀的数据帧