1

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.

David Manheim
  • 2,553
  • 2
  • 27
  • 42
Ryan Warnick
  • 1,079
  • 2
  • 10
  • 15

1 Answers1

2

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.

random_user
  • 820
  • 1
  • 7
  • 18
  • I'm not sure what you mean. The format I used is generally how I've passed large variable vectors to OpenBUGS in the past. I am using the OpenBUGS software and not the R package. Edit: If I can't figure it out I will try to implement it in the R package later as an alternative and see if that fixes it. I don't have time to do that right now though. – Ryan Warnick Apr 17 '13 at 18:35
  • I see, but first check carefully if you haven't miss typed anything while passing your data to BUGS or anything like that, the error might be there. – random_user Apr 17 '13 at 18:46
  • So I found the error, I had an NA in my data for a dependent variable. Thanks for your help. – Ryan Warnick Apr 18 '13 at 22:14