I am new to BUGS so apologies for the simplistic query.
I have a case control study and a cross sectional study, both of which I can run the code for individually. But when I try to combine them using a common parameter as log OR, I am unable to define lor once, and BUGS gives me a multiple node definition error.
Below is my combined code:
model{
# Case-control sub-model
X0cc ~ dbin(p0, Y0cc) # Data model for cancer smoking
logit(p0) <- lp0
X1cc ~ dbin(p1, Y1cc) # Data model for cancer non-smoking
logit(p1) <- lp1
lp1 <- lp0 + lor # lor is log(OR)
lp0 ~ dnorm(0, 0.3)
# prior for logit of probability of exposure for controls
# Cross sectional sub-model
N[1:4]~dmulti(pd[],S)
#Data model for sample
pd[1:4]~ddirch(alpha[])
#prior for vector of probabilities
#comparisons:
or<-(pd[1]*pd[4])/(pd[2]*pd[3])
logit(or)<-lor
S<-sum(N[1:4])
# log OR code and common prior
lor ~ dnorm(0, 0.33) # prior for common log(OR)
OR <- exp(lor) # comparison statistic
}
#Data
list(Y1cc=75, Y0cc=60, X1cc=30, X0cc=17, N=c(18,24,20,30),alpha=c(0.5,0.5,0.5,0.5))
#inits1
list(lr0 = -1, lp0 = -2, lor=-1)
#inits2
list(lr0 = -5, lp0 = 2, lor=5)
I am using openBUGS 3.2.3
Please do not hesitate to contact me for any further information
-------------------------------------------------------------------
This list is for BUGS users to support each other, ask questions or share ideas.
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|