请问用openbugs时,前面模型check,load data,compile 都没有问题,但是在load inits这步,总显示unable to generate initial values for node [011483COH] of type Grapht.Mixing,是什么意思?难道初值设定有问题吗?谢谢

初始值是你给定的还是随机生成的?具体的代码是什么?(贴文本,不要贴附件或截图)

初值是给定的。代码如下:

model{

for (i in 1:n) {

Yisigma2<-1/exp(theta)

Y~dt(0,Yisigma2,k)}

######

isigma2<-(1-phi*phi)*itau2

theta0~dnorm(0,isigma2)

thetamean[1]<-mu+phi*(theta0-mu)

theta[1]~dnorm(thetamean[1],itau2)

for(i in 2:n){

thetamean<-mu+phi*(theta[i-1]-mu)

theta~dnorm(thetamean,itau2) }

########

phi~dnorm(0,100)I(-1, 1)

mu~dnorm(0,0.01)

itau2~dgamma(2.5,0.025)

tau<-sqrt(1/itau2)

kstar~dbin(0.25,50)

k<-kstar+2

}

###################

list(mu=0,itau2=50,phi=0.5,kstar=12,theta0=0.2)

#######

list(n=1627)

Y[ ]

...

END


大致看来,theta应该也是参数,它不需要初始化吗?

自动生成初始值不行吗?

是的,不设可以自动生成。但是不知什么原因,我这么写代码,load inits这步总显示unable to generate initial values for node [011483COH] of type Grapht.Mixing。我尝试很多次,包括theta也赋初值,但是总是显示这句话。

我用R中BRUGS也做过,也是在初值这步显示错误。很奇怪,总觉得没什么问题呢。

3 年 后