楼主: zjjvv
8641 30

[问答] 请教一个关于winbugs的问题 [推广有奖]

11
zhangtao 发表于 2011-6-26 22:36:04
帮你解决问题了:
结果如下:
beta
node         mean         sd         MC error        2.5%        median        97.5%        start        sample
        beta        2.328        1.017        0.02896        1.03        2.06        4.364        1        1000
数学好就是要天天学

12
zhangtao 发表于 2011-6-26 22:41:30
model is syntactically correct
data loaded
model compiled
shape parameter (r) of gamma tau too small -- cannot sample
model is syntactically correct
data loaded
model compiled
initial values generated, model initialized
no monitor set
no monitor set
no monitor set
beta      1.05542791429181
数学好就是要天天学

13
zhangtao 发表于 2011-6-26 22:42:33
model is syntactically correct
data loaded
model compiled
shape parameter (r) of gamma tau too small -- cannot sample
model is syntactically correct
data loaded
model compiled
initial values generated, model initialized
no monitor set
no monitor set
no monitor set
beta      1.05542791429181
decay      0.3601637625881302
数学好就是要天天学

14
zhangtao 发表于 2011-6-26 22:43:07
model is syntactically correct
data loaded
model compiled
shape parameter (r) of gamma tau too small -- cannot sample
model is syntactically correct
data loaded
model compiled
initial values generated, model initialized
no monitor set
no monitor set
no monitor set
beta      1.05542791429181
decay      0.3601637625881302
v[1]      1202688.0
v[2]      1386720.0
v[3]      1285632.0
v[4]      1386720.0
v[5]      1362528.0
v[6]      876096.0
v[7]      252288.0
v[8]      292032.0
v[9]      757728.0
v[10]      596160.0
v[11]      558144.0
v[12]      944352.0
数学好就是要天天学

15
zhangtao 发表于 2011-6-26 22:43:51
model is syntactically correct
data loaded
model compiled
shape parameter (r) of gamma tau too small -- cannot sample
model is syntactically correct
data loaded
model compiled
initial values generated, model initialized
no monitor set
no monitor set
no monitor set
beta      1.05542791429181
decay      0.3601637625881302
v[1]      1202688.0
v[2]      1386720.0
v[3]      1285632.0
v[4]      1386720.0
v[5]      1362528.0
v[6]      876096.0
v[7]      252288.0
v[8]      292032.0
v[9]      757728.0
v[10]      596160.0
v[11]      558144.0
v[12]      944352.0
u[1]      8.774261469759314E-4
u[2]      7.609977980015265E-4
u[3]      8.208259373688001E-4
u[4]      7.609977980015265E-4
u[5]      7.745077043134796E-4
u[6]      0.001204446773401081
u[7]      0.004180440265189812
u[8]      0.003611855381888307
u[9]      0.001392553951668634
u[10]      0.001769842266631827
u[11]      0.001890349909543848
u[12]      0.001117408208516215
数学好就是要天天学

16
zhangtao 发表于 2011-6-26 22:44:40
model is syntactically correct
data loaded
model compiled
shape parameter (r) of gamma tau too small -- cannot sample
model is syntactically correct
data loaded
model compiled
initial values generated, model initialized
no monitor set
no monitor set
no monitor set
beta      1.05542791429181
decay      0.3601637625881302
v[1]      1202688.0
v[2]      1386720.0
v[3]      1285632.0
v[4]      1386720.0
v[5]      1362528.0
v[6]      876096.0
v[7]      252288.0
v[8]      292032.0
v[9]      757728.0
v[10]      596160.0
v[11]      558144.0
v[12]      944352.0
u[1]      8.774261469759314E-4
u[2]      7.609977980015265E-4
u[3]      8.208259373688001E-4
u[4]      7.609977980015265E-4
u[5]      7.745077043134796E-4
u[6]      0.001204446773401081
u[7]      0.004180440265189812
u[8]      0.003611855381888307
u[9]      0.001392553951668634
u[10]      0.001769842266631827
u[11]      0.001890349909543848
u[12]      0.001117408208516215
eta[1]      0.8345970242883363
eta[2]      0.3936090613420744
eta[3]      -0.454716397972738
eta[4]      -0.3697564987857391
eta[5]      -0.5519510934620377
eta[6]      -0.05812879508399809
eta[7]      -0.2736824494281013
eta[8]      -0.1341910432216029
eta[9]      0.4274293246760436
eta[10]      0.4844742445245404
eta[11]      0.2955815411431023
eta[12]      -0.1490627437092613
eta[1]      0.8345970242883363
eta[2]      0.3936090613420744
eta[3]      -0.454716397972738
eta[4]      -0.3697564987857391
eta[5]      -0.5519510934620377
eta[6]      -0.05812879508399809
eta[7]      -0.2736824494281013
eta[8]      -0.1341910432216029
eta[9]      0.4274293246760436
eta[10]      0.4844742445245404
eta[11]      0.2955815411431023
eta[12]      -0.1490627437092613
数学好就是要天天学

17
zhangtao 发表于 2011-6-26 22:45:27
shape parameter (r) of gamma tau too small -- cannot sample
model is syntactically correct
data loaded
model compiled
initial values generated, model initialized
no monitor set
no monitor set
no monitor set
beta      1.05542791429181
decay      0.3601637625881302
v[1]      1202688.0
v[2]      1386720.0
v[3]      1285632.0
v[4]      1386720.0
v[5]      1362528.0
v[6]      876096.0
v[7]      252288.0
v[8]      292032.0
v[9]      757728.0
v[10]      596160.0
v[11]      558144.0
v[12]      944352.0
u[1]      8.774261469759314E-4
u[2]      7.609977980015265E-4
u[3]      8.208259373688001E-4
u[4]      7.609977980015265E-4
u[5]      7.745077043134796E-4
u[6]      0.001204446773401081
u[7]      0.004180440265189812
u[8]      0.003611855381888307
u[9]      0.001392553951668634
u[10]      0.001769842266631827
u[11]      0.001890349909543848
u[12]      0.001117408208516215
eta[1]      0.8345970242883363
eta[2]      0.3936090613420744
eta[3]      -0.454716397972738
eta[4]      -0.3697564987857391
eta[5]      -0.5519510934620377
eta[6]      -0.05812879508399809
eta[7]      -0.2736824494281013
eta[8]      -0.1341910432216029
eta[9]      0.4274293246760436
eta[10]      0.4844742445245404
eta[11]      0.2955815411431023
eta[12]      -0.1490627437092613
eta[1]      0.8345970242883363
eta[2]      0.3936090613420744
eta[3]      -0.454716397972738
eta[4]      -0.3697564987857391
eta[5]      -0.5519510934620377
eta[6]      -0.05812879508399809
eta[7]      -0.2736824494281013
eta[8]      -0.1341910432216029
eta[9]      0.4274293246760436
eta[10]      0.4844742445245404
eta[11]      0.2955815411431023
eta[12]      -0.1490627437092613
cod[1]      0.8354744504353122
cod[2]      0.3943700591400759
cod[3]      -0.4538955720353692
cod[4]      -0.3689955009877375
cod[5]      -0.5511765857577242
cod[6]      -0.05692434831059701
cod[7]      -0.2695020091629115
cod[8]      -0.1305791878397146
cod[9]      0.4288218786277123
cod[10]      0.4862440867911722
cod[11]      0.2974718910526462
cod[12]      -0.1479453355007451
数学好就是要天天学

18
zhangtao 发表于 2011-6-26 22:52:40
model;
{
   for( i in 1 : N ) {
      cod[i] <- u[i] + eta[i]
      u[i] <- (beta / decay) * (1 - exp(( -decay / v[i]) * x))
      eta[i] ~ dnorm( 0.0,tau)
   }
   alpha ~ dunif(0, 1.5)
   decay ~ dunif(0, 0.8)
   beta <- exp(alpha)
   tau ~ dgamma(1,0.1)
   sigma <- 1 / sqrt(tau)
}
Data list(x=1000,N=12,v=c(1202688,1386720,1285632,1386720,1362528,876096,252288,292032,757728,596160,558144,944352))
inits
list(alpha=2.3,tau=1.0,decay=0.1)
修改后程序如上,希望指正!

friend.rar
下载链接: https://bbs.pinggu.org/a-929409.html

206.73 KB

本附件包括:

  • friend.doc

已有 1 人评分学术水平 热心指数 信用等级 收起 理由
epoh + 1 + 1 + 1 热心

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

数学好就是要天天学

19
zhangtao 发表于 2011-6-26 22:55:55
花了阿拉一个下午和晚上,希望多指正!多交流!
数学好就是要天天学

20
zjjvv 发表于 2011-6-27 16:12:55
我现在知道错在哪里了,是我建模的问题,这个公式cod[i] <- u[i] + eta[i]本身就是有问题的,谢谢了,这么热心

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

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