nuomin 发表于 2014-4-5 21:08 
garch模型要求方差大于零,考虑这个问题了吗?
我修改成exponential的方式,資料數少的時候還能跑,但是資料多的時候就跑不動了
一直找不到問題在哪,資料一多load inits就會當掉了
model
{
for (t in 1:T)
{
y[t]~dnorm(0,p[t])
}
for (t in 2:T)
{
h[t]<-pow(h[t-1],b)*exp(w+alpha*(abs(e[t-1])-0.79788456)+theta*e[t-1])
p[t]<-1/h[t]
e[t]<-y[t]/sqrt(h[t])
}
h1<-exp(0.2/(1-0.98))
h[1]<-h1
p[1]<-1/h[1]
e1<-y[1]/sqrt(h[1])
e[1]<-e1
# piror
w~dnorm(0,1)
b~dbeta(8,1)I(0,1)
theta~dnorm(0,1)
alpha~dnorm(0,1)
}
# initial
list(w=0.2, b=0.98, theta=0.05, alpha=0.15)
# data
list(T=10, y=c(-0.004935767,
-0.007029977,
-0.004895137,
-0.022116165,
0.001567211,
-0.014067703,
-0.012938876,
0.001584612,
0.010732848,
0.007028073))