OpenBUGS - Variable is not defined

穿精又带淫゛_ 提交于 2019-12-02 12:21:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!