楼主: farewell0
8086 18

请教用winbugs估计SV模型中遇到的一个问题!! [推广有奖]

  • 0关注
  • 0粉丝

已卖:1份资源

高中生

35%

还不是VIP/贵宾

-

威望
0
论坛币
150 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
326 点
帖子
18
精华
0
在线时间
39 小时
注册时间
2007-10-11
最后登录
2024-4-6

楼主
farewell0 发表于 2010-12-14 17:50:43 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
本人摸索用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))
求高人指点
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:winbugs WINBUG SV模型 BUGS bug winbugs

本帖被以下文库推荐

沙发
farewell0 发表于 2010-12-16 21:50:02
自己顶啊!!!!

藤椅
epoh 发表于 2010-12-20 17:00:26
model{
### likelihood: joint distribution of y
for (i in 1:n)
{yisigma2[i]<-1/exp(theta[i])
y[i] ~dt(0,yisigma2[i],s);
}
### prior distributions
s~dchisqr(8)I(2,50);
phi1~dbeta(20,1.5)
phi<-2*phi1-1
mu~dnorm(0,0.01)
beta<-exp(mu/2)
itau2~dgamma(2.5,0.025)
tau<-sqrt(1/itau2)

theta0~dnorm(mu,itau2)
thmean[1]<-mu+phi*(theta0-mu)
theta[1]~dnorm(thmean[1],itau2)
for (j in 2:n)
{thmean[j]<-mu+phi*(theta[j-1]-mu)
theta[j]~dnorm(thmean[j],itau2)
}
}

板凳
farewell0 发表于 2011-1-6 23:15:53
3# epoh
谢谢哦~~ 不好意思,这么迟才回复

报纸
hexw529 发表于 2011-7-26 19:34:19
我运行您给出的SV-T MCMC程序时候出错,麻烦您帮我看一下。
程序为:
model{ for (i in 1:n) {yisigma2[i]<-1/exp(theta[i]) y[i] ~dt(0,yisigma2[i],s); } s~dchisqr(8)I(2,50); phi1~dbeta(20,1.5) phi<-2*phi1-1 mu~dnorm(0,0.01) beta<-exp(mu/2) itau2~dgamma(2.5,0.025) tau<-sqrt(1/itau2) theta0~dnorm(mu,itau2) thmean[1]<-mu+phi*(theta0-mu) theta[1]~dnorm(thmean[1],itau2) for (j in 2:n) {thmean[j]<-mu+phi*(theta[j-1]-mu) theta[j]~dnorm(thmean[j],itau2) } } list(y=c(-8.76,-35.27,-41.52,10.83,22.37,-8.00,11.34,20.42,-23.44,-9.92,15.79,13.96, -36.52,4.71,-23.26,-24.59,-2.17,-36.65,-40.37,24.96,11.22,-1.97,-45.92,0.95,-6.29,-55.69 ,48.26,-2.08,-70.60,5.61,28.96,43.54,3.58,-56.55,16.80,6.07,-57.82,15.55,-17.09, -21.14,-40.55,7.18,9.84,40.63,88.87,-7.08,-23.61,13.92),n=48) list(mu=0,itau2=0.5,s=6,theta0=0.97)

在gen ints 时 报错: unable to generate initial values for node[01055130H] of type GraphT.Mixing. 若我再给其他的变量赋初值,仍然处现错误,只不过 node的位置变化了。

地板
epoh 发表于 2011-7-26 21:04:29
pls remove s=6
#init data
  list(mu=0,itau2=0.5,s=6,theta0=0.97)
change to
  list(mu=0,itau2=0.5,theta0=0.97)

7
zhangtao 发表于 2011-7-26 23:06:19
6# epoh
s也是一个变量,为什么不用赋初值呢?
数学好就是要天天学

8
zhangtao 发表于 2011-7-26 23:28:37
Undefined symbols:
    getData2                           C:\222\star\Wingauss\prg\Star.prg(42)
附件中的STAR-STGARCH中的每一个prg程序都运行提示错误,
其中star.prg提示以上错误,epoh老师,您看如何解决呢?
非常感谢!

stcode.zip
下载链接: https://bbs.pinggu.org/a-939166.html

390.84 KB

本附件包括:

  • Readme.doc
  • Readme.ps
  • Abstract_STAR-STGARCH.doc

数学好就是要天天学

9
epoh 发表于 2011-7-27 14:44:17
zhangtao兄
这个问题我回覆在
https://bbs.pinggu.org/thread-1138455-1-1.html
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
ywh19860616 + 5 + 5 + 5 epoh老师,您知识面太广了

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

10
星缘224 发表于 2012-3-19 10:38:08
你好我想请教一下
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)
}
这是什么意思啊

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-9 10:36