Hello All, I have received no response to my previous questions. Accordingly, I am stating the problem in simpler terms. I am trying to run the code below. It contains the log and exp functions. To avoid numerical errors, I capping the lower value of the input to the log function to 1.0E-6 and the upper value of the input to the exp function to 10. The program compiles and generates the initial values. Once I try to run the MCMC chains, however, I receive an error message about an "undefined real value." I see no reason why there any out-of-bound numbers are generated. Does anyone have any suggestions? model { for (i in 1:T) { y[id[i],im[i]] <- Mode[i]; z[id[i],im[i],1] <- log(TIME[i] + 1); z[id[i],im[i],2] <- log(IVC[i]); z[id[i],im[i],3] <- log(IVT[i]); } for (t in 1:N) { for (k in 1:P) { LL[t,k] <- y[t,k] * log(max(p[t,k],1.0E-6)); } } L <- sum(LL[,]); for (j in 1:P) { Y[j] <- sum(y[,j]); } # mode m=3 is isolate; for (t in 1:N) { R[t] <- exp(min(z[t,m,1] * delta[t,1] + z[t,m,2] * delta[t,2] + z[t,m,3] * delta[t,3],10.0)); for (k in 1:2) { S[t,k] <- max(exp(min(z[t,k,1] * b[t,1] + z[t,k,2] * b[t,2] + z[t,k,3] * b[t,3],10.0)), 1.0E-6); } } for (t in 1:N) { y[t,1:3] ~ dmulti(p[t,1:3],1); V[t] <- sum(S[t,1:2]); # inclusive value; I[t] <- log(max(V[t],1.0E-3)); p[t,3] <- R[t] / (R[t] + exp(min(b[t,4] * I[t],10.0))); p[t,1] <- (1 - p[t,3]) * S[t,1] / V[t]; p[t,2] <- (1 - p[t,3]) * S[t,2] / V[t]; b[t,1:4] ~ dmnorm(bm[], bp[,]); } bm[1] ~ dnorm(0,1.0E-6); bm[2] ~ dnorm(0,1.0E-6); bm[3] ~ dnorm(0,1.0E-6); bm[4] ~ dexp(1); bp[1:4,1:4]~dwish(pbp[,],4); for(k in 1:4) { pbp[k,k] <- 1.0 for(k2 in (k+1):4) { pbp[k,k2] <- 0.0; pbp[k2,k] <- 0.0; } } for (t in 1:N) { for (j in 1:3) { delta[t,j] <- b[t,j] * b[t,4]; } } } Ziad Elmously Analytics and Sampling TNS Intersearch 410 Horsham Rd. Horsham, PA 19044 Phone (215) 442-9885 Fax (215) 442-9040 Please note the new email address: Email [log in to unmask] Web <file:///C:\Documents%20and%20Settings\ZElmousl\Application%20Data\Microsoft \Signatures\www.tns-i.com> www.tns-i.com ---------------------------------------------------------------------------- ------------------ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. ---------------------------------------------------------------------------- ----------------- ------------------------------------------------------------------- This list is for discussion of modelling issues and the BUGS software. For help with crashes and error messages, first mail [log in to unmask] 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