Dear all,
I am trying to model a system using OpenBUGS (windows version). I assigned multivariate normal distribution to my prior and defined a likelihood function using the multinomial distribution. The is checked successfully, data is loaded and compiled successfully. When I tried to initialize the model using the 'gen inits', OpenBUGS gives me an error which reads: "error for node n5[1] of type GraphMultinom. Node first argument must be a proportion". The model is attached below and would appreciate any suggestions to resolve this.
Thank you.
model
{
for (k in 1:4) {
alpha4[k]<-((5-k)*alpha5[k]+(k+1)*alpha5[k+1])/(5-alpha5[1])
}
for (k in 1:3) {
alpha3[k]<-((4-k)*alpha4[k]+(k+1)*alpha4[k+1])/(4-alpha4[1])
}
for (k in 1:2) {
alpha2[k]<-((3-k)*alpha3[k]+(k+1)*alpha3[k+1])/(3-alpha3[1])
}
# Enter the top alpha prior (multivariate normal)
alpha5[1:5]~dmnorm(thetaprior[],var[,])
# Define likelihoods
n5[1:5]~dmulti(alpha5[1:5],ntot5)
n2[1:2]~dmulti(alpha2[1:2],ntot2)
alpha.T[5]<-inprod(integers[1:5],alpha5[1:5])
alpha.T[4]<-inprod(integers[1:4],alpha4[1:4])
alpha.T[3]<-inprod(integers[1:3],alpha3[1:3])
alpha.T[2]<-inprod(integers[1:2],alpha2[1:2])
Qtexpos<-2*ND2/alpha.T[2]+5*ND5/alpha.T[5]
Ptot4expos<-(alpha.T[4]/4)*Qtexpos
shapepost<-ntottot
Ptot4~dgamma(shapepost,Qtexpos)
A4[1]<-alpha4[1]
A4[2]<-alpha4[2]/(1-A4[1])
A4[3]<-alpha4[3]/(1-A4[2])
for (k in 1:3) {
L4[k]<-logit(A4[k])
}
LPtot4<-log(Ptot4)
}
#Data
list(
integers = c(1, 2, 3, 4, 5, 6),
thetaprior = c(0.5, 0.5, 0.5, 0.5, 0.5),
n5 = c(3, 2, 1, 1, 1), ntot5 = 8, ND5 = 100,
n2 = c(3, 1), ntot2 = 4, ND2 = 200,
ntottot = 19,
var=structure(.Data= c(0.07, 0, 0, 0, 0,
0, 0.07, 0, 0, 0,
0, 0, 0.07, 0, 0,
0, 0, 0, 0.07, 0,
0, 0, 0, 0, 0.07),
.Dim= c(5,5)))
-------------------------------------------------------------------
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
|