本人摸索用winbugs估计SV模型过程中遇到了的问题如下:在specification tool 窗口按compile时出现了错误提示
array index is greater than array upper bound for y!!如何解决啊???
具体的模型,和数据设置如下
model
{
for (t in 1:n){yisigma2[t]<-1/exp(theta[t])
y[t] ~ dnorm(0,yisigma2[t])
}
mu~dnorm(0,0.1)
phistar~dbeta(20,1.5)
itau2~dgamma(2.5,0.025)
beta<-exp(mu/2)
phi<-2*phistar-1
tau<-sqrt(1/itau2)
theta0~dnorm(mu,itau2)
thmean[1]<-mu+phi*(theta0-mu)
theta[1]~dnorm(thmean[1],itau2)
for(t in 2:n) {thmean[t]<-mu+phi*(theta[t-1]-mu)
theta[t]~dnorm(thmean[t],itau2)
}
}
list(n=20,y=c(0.01965,0.0234,0.05664,0.047704,0.029483,0.01203,0.003767,0.007112,0.000838,0.0325,0.02449,0.00015,0.042398,0.045487,0.001113,0.022363,0.03888,0.033397,0.035908,0.022705))
求高人指点


雷达卡


京公网安备 11010802022788号







