Hi there,
I hope this email finds you well. Last week I come up with a problem with my code for initializations as the P[] values in priors where not satisfied for 0<p<1. I received very helpful advice to change the P[] prior to Dirichlet. I think the problem with priors are now fixed
but again the code cannot be initialized. I received this error "error of node k[1] of type graphmultinom, node invalid integer value".
I used integer value for k[], but do not get what is the issue. I just guess it is a problem with reading k[] values. I will be thankful if you help me with this. Here is the final code:
------------------------------------------------------------------- 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 listDear Bob,
Thank you for your valuable advice. I did what you suggest. when i used Dirichlet distribution, i received just this error "Dirichlet35" after pushing get initials. it may be useful to know that, i have no problem with the code if the theta is less than 4, but when i increase the number of theta then this problem occurs. here is the code:
model{# MPT Category Probabilities for Word Pairstheta[1] <- p1 * u1theta[2] <- (p2) * u2theta[3] <- (p3) * u3theta[4] <- (p4) * u4theta[5] <- (p5) * u5theta[6] <- (1-p1-p2-p3-p4-p5) * u6
theta[7] <- 1-theta[1]-theta[2]-theta[3]-theta[4]-theta[5]-theta[6]
# Datafor (i in 1:n) {k[i,1:7] ~ ddirch(theta[1:7])}# Priorsp1 ~ dbeta(1,1)p2 ~ dbeta(1,1)p3 ~ dbeta(1,1)p4 ~ dbeta(1,1)p5 ~ dbeta(1,1)
u1 ~ dunif(0,1)u2 ~ dunif(0,1)u3 ~ dunif(0,1)u4 ~ dunif(0,1)u5 ~ dunif(0,1)u6 ~ dunif(0,1)
}list(n= 6, k = structure(.Data = c(1,0,0,0,0,0,6,0,1,0,0,0,0,5,0,0,1,0,0,0,8,0,0,0,1,0,0,3,0,0,0,0,1,0,6,0,0,0,0,0,2,4), .Dim = c(6, 7)))
From: Bob OHara <[log in to unmask]>
Sent: 13 June 2019 17:41:39
To: Mohammad Abaei; [log in to unmask]
Subject: Re: [BUGS] Error in InitializingThere is nothing in the code to stop (say) theta[1] + theta[2] being greater than 1.
One solution is to use a Dirichlet distribution. Another is to divide the theta's by their sum. Which is better is difficult to say without knowing the modelling context.
Bob
On 6/13/19 4:03 PM, Mohammad Abaei wrote:
------------------------------------------------------------------- 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 listHi there,
I will be thankful if you guide me on running my code.
The code is synthetically correct and I can choose the chains to compile the code. However, winbugs would not allow me to get the initials and give this error "Elements of proportion vector of multinomial k[1,1] must be between zero and one. However, i satisfied this requirement in my code when i defined theta [9] and [10]. could you kindly advice me on this issue?
Here is the code:
model{theta[1] <- p1 * u1
theta[2] <- p2 * u2theta[3] <- p3 * u3theta[4] <- p4 * u4theta[5] <- p5 * u5theta[6] <- p6 * u6theta[7] <- p7 * u7theta[8] <- p8 * u8theta[9] <- (1-(p1+p2+p3+p4+p5+p6+p7+p8) )* (u9)theta[10] <- (p1 * (1-u1)) +(p2* (1-u2))+(p3* (1-u3))+(p4* (1-u4))+(p5* (1-u5))+(p6* (1-u6))+(p7* (1-u7))+(p8* (1-u8))+ ((1-(p1+p2+p3+p4+p5+p6+p7+p8) )*(1-u9))
# Datafor (i in 1:n) {k[i,1:10] ~ dmulti(theta[1:10],n)}# Priorsp1 ~ dbeta(1,1)p2 ~ dbeta(1,1)p3 ~ dbeta(1,1)p4 ~ dbeta(1,1)p5 ~ dbeta(1,1)p6 ~ dbeta(1,1)p7 ~ dbeta(1,1)p8 ~ dbeta(1,1)
u1 ~ dbeta(1,1)u2 ~ dbeta(1,1)u3 ~ dbeta(1,1)u4 ~ dbeta(1,1)u5 ~ dbeta(1,1)u6 ~ dbeta(1,1)u7 ~ dbeta(1,1)u8 ~ dbeta(1,1)u9 ~ dbeta(1,1)
}list(n= 9, k = structure(.Data = c(1,0,0,0,0,0,0,0,0,6,0,1,0,0,0,0,0,0,0,5,0,0,1,0,0,0,0,0,0,8,0,0,0,1,0,0,0,0,0,3,0,0,0,0,1,0,0,0,0,6,0,0,0,0,0,2,0,0,0,4,0,0,0,0,0,0,1,0,0,6,0,0,0,0,0,0,0,1,0,4,0,0,0,0,0,0,0,0,1,2
), .Dim = c(9, 10)))
Thank you for your consideration, in advance.
Regards,Mahdi
-- Bob O'Hara Institutt for matematiske fag NTNU 7491 Trondheim Norway Mobile: +47 915 54 416 Journal of Negative Results - EEB: www.jnr-eeb.org