楼主: Lisrelchen
2474 3

[精彩WinBUGS答问]Error Message in WinBUGS:Array index is less than one [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4194份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

威望
0
论坛币
50288 个
通用积分
83.6906
学术水平
253 点
热心指数
300 点
信用等级
208 点
经验
41518 点
帖子
3256
精华
14
在线时间
766 小时
注册时间
2006-5-4
最后登录
2022-11-6

楼主
Lisrelchen 发表于 2014-6-16 11:46:42 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
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?
二维码

扫码加我 拉你入群

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

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

关键词:winbugs Message WINBUG array Error Error

沙发
Lisrelchen 发表于 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

藤椅
Lisrelchen 发表于 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

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

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-2-1 18:06