问题
I'm using the following code in OpenBUGS to perform an analysis:
model
{
for(i in 1:467)
{
probit(p[i])<-gamma0+gamma1*drug[i]+gamma2*CD41[i]
R[i]~dbern(p[i])
junk[i]<-ID[i]
}
gamma0~dnorm(0,.0001)
gamma1~dnorm(0,.0001)
gamma2~dnorm(0,.0001)
}
ID[] drug[] CD41[] R[]
1 0 114 NA
2 1 40 NA
3 1 12 0
4 0 15 0
....
END
And I'm receiving the following error: Variable CD41[] is not defined. I'm not sure how to fix this problem, so any help would be greatly appreciated.
回答1:
Are you sure you are passing the vector variable CD41
correctly to your dataList?
If are using R, try to call CD41<-as.vector(CD41)
before passing it to OpenBUGS. Remember that 1 column matrix and a vector are different things for both BUG and for R.
来源:https://stackoverflow.com/questions/16094450/openbugs-variable-is-not-defined