全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 winbugs及其他软件专版
2438 3
2014-06-16
for (i in 1:160) {
    situps ~ dnorm(mu,prec[gender+1]);
    mu <- b0+b1[gender]+b2[health]+b1b2[health,gender];
}
b0 ~ dnorm(0,.001);
for (i in 1:4) {
    b2 ~ dnorm(0,.001);
}
for (j in 1:2) {
    b1[j] ~ dnorm(0,.001);
    prec[j] <- pow(sigma[j],-2);
    sigma[j] ~ dunif(0,10);
}
for (i in 1:4) {
    for (j in 1:2) {
        b1b2[i,j] ~ dnorm(0,.001);
    }
}
I'm not sure why this gives me the error "array index is less than one" because I clearly have all of my arrays starting at 1. Any ideas?
二维码

扫码加我 拉你入群

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

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

全部回复
2014-6-16 11:50:13
How is gender coded? Your use of prec[gender[i]+1] looks problematic. Try something like

situps[i]~dnorm(mu[i],tau[i])
tau[i] <- prec[gender[i]] # or some similar function
mu[i]<-b0+b1[gender[i]]+b2[health[i]]+b1b2[health[i],gender[i]]
NB you don't need the semi-colons at the end of each line
二维码

扫码加我 拉你入群

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

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

2014-6-16 11:50:46
Indexing with gender[i] + 1 doesn't seem as problematic as indexing with gender[i] and health[i] in this case
二维码

扫码加我 拉你入群

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

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

2015-8-5 15:22:45
你好!
请问你解答出来了吗?我在编译的过程中也遇到这个问题。array index is less than one
麻烦再加QQ327871324讨论一下呢。谢谢!
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群