我正在使用 WinBUGS 包研究差异项功能模型。我已经成功地构建了更简单的模型,但我也收到了错误“预期的集合运算符 c”。如果您能提供帮助,我将非常高兴。
# Model
Model
{
for (j in 1:40){
for (k in 1:5){
y[j,k] ~ dbern(p[j,k])
logit(p[j,k])<- u2[j] - beta[k] + gamma[k]*grp[j]
}
}
# Random effect prior
for (j in 1:40){
u2[j] ~ dnorm(0,tau.u2)
}
# Fixed effect prior
for (k in 1:5){
beta[k] ~ dnorm(0, .0001)
gamma[k] ~ dnorm(0,.0001)
}
tau.u2 <- pow(sigma.u2, -2)
sigma.u2 ~ dunif (0, 100)
}
# Data
list(y=structure(
.Data=c(1, 1, 1, 1, 1,
1, 0, 1, 0, 1,
0, 1, 1, 1, 1,
1, 0, 0, 1, 1,
1, 0, 0, 0, 1,
0, 1, 1, 1, 0,
0, 1, 1, 1, 1,
1, 0, 0, 0, 1,
1, 0, 1, 1, 1,
0, 1, 0, 0, 0,
1, 1, 1, 0, 1,
0, 1, 1, 0, 1,
1, 1, 1, 1, 1,
0, 1, 0, 1, 0,
1, 1, 1, 1, 1,
0, 0, 1, 1, 1,
0, 0, 0, 1, 0,
1, 1, 1, 0, 0,
1, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 0, 0, 1,
0, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 0, 0, 0,
1, 0, 0, 1, 0,
1, 1, 1, 1, 0,
1, 1, 0, 0, 1,
0, 1, 1, 1, 1,
1, 1, 0, 0, 0,
0, 0, 0, 1, 0,
0, 1, 1, 1, 0,
1, 0, 1, 1, 0,
1, 0, 1, 0, 0,
0, 0, 1, 1, 0,
0, 0, 1, 1, 0,
0, 1, 0, 1, 0,
1, 1, 1, 1, 0,
0, 0, 0, 1, 1),
.Dim=c(40,5)), grp=c(1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0))
#Initital values
list(beta=c(0, 0, 0, 0, 0), gamma=c(0, 0, 0, 0, 0), sigma.u2=1, u2=0))