本人菜鸟一个,想用最基本的随机波动模型来做模型率预测,借鉴了其他文章中的model,但是在数据初始化中总有问题,请问是需要对theta0,theta[t]初始化吗?如果需要的话,怎样处理比较合适呢?求助各位好心的哥哥姐姐们了,灰常感谢!
model
{
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)
}
for (t in 1:n){
yisigma2[t]<-1/exp(theta[t])
y[t]~dnorm(0,yisigma2[t])
}
for (t in 1:n){
v[t]<-exp(theta[t])
resid[t]<-y[t]/exp(theta[t]/2)
}
}