我正在尝试为我的二进制数据建模一个多元 Probit 模型。我一直在尝试一切,但 WinBUGS 作为回报给了我这个错误。任何想法或建议都受到热烈欢迎。
model{ for (i in 1:ns){ ## 循环研究
for (k in 1:2){ ### loop over arm
for (j in 1:2){ ### loop over outcomes
r[i,k,j] ~ dbin(p[i,k,j],n[i,k,j]); ## Likelihood Function
p[i,k,j] <- phi(z[i,k,j])
z[i,k,1:2] ~ dmnorm(theta[i,1:2],with[i,,])I(-5, 5) #latent variable (z<0) or Probit link
theta[i,1] <- alpha[i,k,1] + beta[i,k,1]
theta[i,2] <- alpha[i,k,2] + beta[i,k,2]
} ###Close loop over outcomes
} ###Close loop over arms
alpha[i,2,1] <- 0
alpha[i,2,2] <- 0
alpha[i,1,1:2] ~ dnorm(0,.0001)
beta[i,2,1:2] ~ dmnorm(d[1:2],prec[,])
beta[i,1,1] <- 0
beta[i,1,2] <- 0
## priors on within study cov matrix
with[i,1:2,1:2] <- inverse(cov.mat[i,1:2,1:2])
#define elements of within-study covariance matrix
cov.mat[i,1,1] <- 1
cov.mat[i,2,2] <- 1
### prior from IPD data ######
cov.mat[i,1,2] ~ dbeta(a[i],b[i])
cov.mat[i,2,1] <- cov.mat[i,1,2]
a[i]<-31.97
b[i]<- 4.52
}#### Close loop over studies
for (i in 1:2) {
d[i] ~ dnorm(0.0000E+00, 0.0001) # overall treatment effects
}
## priors on between study cov matrix
prec[1:2,1:2]<-inverse(tau[1:2,1:2])
pi<-3.14/2
a1~dunif(0, pi)
rho.tau<-cos(a1)
sd[1]~dunif(0,2)
sd[2]~dunif(0,2)
tau[1,1]<-pow(sd[1],2)
tau[2,2]<-pow(sd[2],2)
tau[2,1]<-tau[1,2]
tau[1,2]<-sd[1]*sd[2]*rho.tau
} #END MODEL
这些是我的数据:
list(ns=2)
t[,1,1] t[,1,2] t[,2,1] t[,2,2] r[,1,1] n[,1,1] r[,2,1] n[,2,1] r[,1,2] n[,1,2] r[,2,2] n[,2,2]
1 0 1 0 19 77 23 77 60 82 70 82
1 0 1 0 27 199 54 199 231 393 318 393
END
该模型在语法上是正确的,它允许我加载数据。编译后,标题中出现错误。感谢您提供的任何帮助