模型通过,数据可以载入,在进行Compile时,Winbugs提示说‘array index is greater than array upper bound for y’(数据),是不是因为数据数量太大了?不过只有236个数据啊;换了数据载入方式之后,系统又提示说:‘educational version cannot do this model‘ ;还有,在设定初始值的时候“list(theta[1]=1, mu=1, itau2=1, phi1=0.5, omega=8)”提示”expected an equals sign“ ,求各位大侠帮忙指出错误,万谢啊!
请问版主,该怎么修改滞后项啊。我的代码:输入的data---sst是一个120*120的矩阵,lat和log分别是120个矢量,表示经纬度。意思是每一个矩阵元素的均值是他上下左右元素的加权均值。
for (i in 2:119){
for (j in 2: 119){
sst[i,j]~dnorm(mu[i,j],tau)
mu[i,j]<-mu0[i,j]+alfa*((mu[i-1,j]-mu0[i-1,j])+(mu[i+1,j]-mu0[i+1,j]))+beta*((mu[i,j-1]-mu0[i,j-1])+(mu[i,j+1]-mu0[i,j+1]))+errorsigma[i,j]
mu0[i,j]<-mu01 + mu02* lat[j]+ mu03*log[i]
errorsigma[i,j]~dgamma(0.001,0.001)
}
}
在compile的时候,总是提示:array index is greater than array uper bound for mu 是怎么回事啊。
请指教
我也遇到了这个问题~不知道楼主解决没有~我在网上搜到是这个问题~
This is one of two problems. The first potential problem is miscounting, depending on how your indexing works. As in, you think you have 1000 observations, but you really only have 999.
Even if you counted correctly, this error message occurs when you don't have an extra blank line *after* "END". So, your rectangular form must be:
list(N=n)
a[] b[] c[]
a1 b1 c1
a2 b2 c2
.....
an bn cn
END
[blank line]
On a related note, you can have any value for n that is less than the total number of observations and it will just read in that many observations