楼主: uglyuglywong
2399 2

急急急急急:就是找不到uninitialized variables! [推广有奖]

  • 0关注
  • 0粉丝

学前班

70%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
20 点
帖子
1
精华
0
在线时间
0 小时
注册时间
2010-7-14
最后登录
2010-7-16

楼主
uglyuglywong 发表于 2010-7-14 03:45:46 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
哪位大侠帮忙看看,我检查了很多很多遍,就是找不到没有附初始值的变量。。。但winbugs 总是提示有 uninitialized variables!!!! 我不想要winbugs 自动生成初始值

先谢谢啦


code:
model
{for(i in 1: N) {

# generate data

boxoffice[i] ~ dnorm(ubo[i], tau[1])
screen[i] ~ dnorm(uscr[i], tau[2])
ad[i] ~ dnorm(uad[i], tau[3])



meancc[i] ~ dnorm(cc[i], varn[1])
meansh[i] ~ dnorm(sh[i], varn[2])
jaccard[i] ~ dnorm(se[i], varn[3])


ability[i] ~ dnorm(-1, z)

#regress network attributes on latent V

cc[i]<- alpha[1]+gamma[1]*ability[i]+res[i,1]
sh[i]<- alpha[2]+gamma[2]*ability[i]+res[i,2]
se[i]<- alpha[3]+gamma[3]*ability[i]+res[i,3]


# regress bo, ad and screen on predictors

log(ubo[i])<-beta[1]+lamda[1]*ability[i]+delta[1]*res[i,1]+theta[1]*res[i,2]+zeta[1]*res[i,3] + eta[1]*log(screen[i])+ phi[1]*log(ad[i])+ pi[1]*comp[i] +kappa[1]*log(budget[i])

log(uscr[i])<- beta[2]+lamda[2]*ability[i]+delta[2]*res[i,1]+theta[2]*res[i,2]+zeta[2]*res[i,3]+kappa[2]*log(budget[i])

log(uad[i])<- beta[3]+lamda[3]*ability[i]+delta[3]*res[i,2]+theta[3]*res[i,2]+zeta[3]*res[i,3]+kappa[3]*log(budget[i])



}

# priors on regression parameters and precisions


for(i in 1: N) {res[i,1:3] ~ dmnorm (mean[1:3], tau.res[1:3, 1:3])}
tau.res[1:3, 1:3] ~ dwish(R[1:3,1:3],3)

R[1,1]<-1
R[2,2]<-1
R[3,3]<-1
R[2,1]<-R[1,2]
R[1,2]<-0
R[1,3]<-R[3,1]
R[3,1]<-0
R[2,3]<-R[3,2]
R[3,2]<-0
for (i in 1:3) {mean[i] <- 0}


for (j in 1:3) {varn[j] ~ dgamma(1, 0.001)}

for (j in 1:3) {tau[j] ~ dgamma(0.5, 0.5)}

z ~ dgamma(0.5, 0.5)


for (j in 1:3) {alpha[j] ~ dnorm(0,0.001);
gamma[j] ~ dnorm(0,0.001);
beta[j] ~ dnorm(0, 0.001);
lamda[j] ~ dnorm(0,0.001);
delta[j]~dnorm(0,0.001);
theta[j]~dnorm(0,0.001);
zeta[j]~dnorm(0, 0.001);
kappa[j]~dnorm(0,0.001)}

eta[1] ~dnorm(0,0.001)
phi[1] ~dnorm(0,0.001)
pi[1] ~dnorm(0,0.001)

}



初始值  :Initial values for chain 1:

list(alpha=c(0,0,0), gamma=c(0,0,0), beta=c(0,0,0),lamda=c(0,0,0), delta=c(0,0,0), theta=c(0,0,0), zeta=c(0,0,0), kappa=c(0,0,0), eta=c(0), phi=c(0), pi=c(0), z=1, tau=c(1,1,1), varn=c(1,1,1), tau.res=structure(.Data=c(1.0E-6,0,0,0,1.0E-6,0,0,0,1.0E-6),.Dim=c(3,3)))

Initial values for chain 2:

list(alpha=c(1,1,1), gamma=c(1,1,1), beta=c(1,1,1),lamda=c(2,2,2), delta=c(2,2,2), theta=c(2,2,2), zeta=c(2,2,2), kappa=c(2,2,2), eta=c(0), phi=c(0), pi=c(0), z=2, tau=c(0.5,0.5,0.5), varn=c(0.5,0.5,0.5), tau.res=structure(.Data=c(0.1,0,0,0,0.1,0,0,0,0.1),.Dim=c(3,3)))
二维码

扫码加我 拉你入群

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

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

关键词:Variables Variable Initial ABLE ABL winbugs

沙发
libaijun19 发表于 2011-10-6 15:31:08
你看看下面的 step 我按照这样解决了

STEP 8: Notice that in the lower left hand corner it says “initial values loaded but this or another chain contain uninitialized variables”.  It says this because all of the latent variables in the model (within the Bayesian framework) are also considered parameters and thus each individual’s latent variables need starting values too.  Rather than enter 500*3 starting values for all the latent variables, we use the “gen inits” button which allows Winbugs to specify the starting values.  Click on the “gen inits” button and notice that now it says “initial values generated, model initialized” in the lower left hand corner.

藤椅
qoiqpwqr 发表于 2011-10-6 23:51:57
楼主发了个急急急急急的帖子,然后一年多后终于有人回复了。:-)

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

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