ab<-list(a=0.1,b=0.1,theta=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), ypred=c(0,7,1,5,1,1,5,16,0,15,4,0,0,1,1,7,1,3,0,0,8,2,13,7,0,8,0,3,2,4,1,11,0,1,2,3,3,8,6,14,3,11,6,0,1,5)) ac<-list(a=0.12,b=0.12,theta=c(1.2,1,1,1,1,1,1,1,1,1.2,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1.2,1,1,1,1,1,1,1,1,1,1,1.5,1,1,1.6,1,1,1,1), ypred=c(0,7,1,5,1,1,5,16,0,15,4,0,0,0,0,6,1,2,0,0,8,2,13,7,0,8,0,3,2,4,1,11,0,1,2,3,3,8,6,14,3,11,6,0,1,5)) ad<-list(a=0.15,b=0.17,theta=c(1.4,1,1,1,1,1,1,1,1.8,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1.2,1,1,1,1,1,2.1,1,1,1,1,1,1,1,1,1,1.1,1,1), ypred=c(0,7,1,5,0,0,0,0,0,0,4,0,0,1,1,7,1,3,0,0,8,2,13,7,0,8,0,3,2,4,1,11,0,1,2,3,3,8,6,14,3,11,6,0,1,5)) ainits<-list(ab,ac,ad) adat<-list( m=46, y=c(0,7,1,5,1,1,5,16,0,17,4,0,0,1,1,7,1,3,0,0,8,2,13,7,0,8,0,3,2,4,1, 11,0,1,2,3,3,8,6,14,3,11,6,0,1,5), e=c(1.129778827,6.667008775,0.650279674,6.988864371,0.95571406,1.123210345,5.908349156,8.539026017,0.601016062,18.92051111, 2.272694617,1.73736337,2.019808077,1.688099759,1.747216093, 3.221840201,1.835890594,5.221942834,0.978703751,1.254579976, 6.407553754,2.676656232,16.57884744,3.077333607,1.087083697, 7.606301637,1.018114641,2.15774619,2.844152512,2.955816698, 0.985272233,9.22871658,0.38097193,1.855596038,1.579719813, 1.579719813,2.647098065,4.791707292,4.144711859,15.70852363, 0.765228101,11.32077795,6.256478678,1.500898035,2.085492893, 7.297583004) ) #### change directory setwd ######################### library(R2OpenBUGS) parameters<-c("mu","r","rpred","probexc") map.sim1<-bugs(adat,inits = ainits, parameters,n.iter=10000,model.file ="map_modelWB_pred.txt") map.sim1 ########################################################### #### log normal model #################################### ab2<-list(v=rep(0,46),tauv=0.1,a0=0.1) ainits2<-list(ab2) parameters2<-c("deviance") map.sim2<-bugs(adat,inits = ainits2, parameters2,n.iter=10000,n.chains=1,codaPkg=TRUE,model.file ="map_modelOB_lognorm.txt") library(coda) al2<-read.bugs(map.sim2) geweke.diag(al2) geweke.plot(al2)