Hi,

NICE produce some great docs on Mixed Treatment Comparisons - search "NICE TSD" in google. The code provided is all in Winbugs. I'm trying to convert to JAGS to take advantage of running parallel chains on multi-processors using runjags.

Here's my R jags code for example 5 in NICE's TSD2:

library(runjags) jags.MTC <- "model{ for(i in 1:ns){ # LOOP THROUGH STUDIES mu[i] ~ dnorm(0,.0001) # vague priors for all trial baselines for (k in 1:na[i]) { # LOOP THROUGH ARMS vari[i,k] <- pow(se[i,k],2) # calculate variances prec[i,k] <- 1/vari[i,k] # set precisions y[i,k] ~ dnorm(theta[i,k],prec[i,k]) # normal likelihood theta[i,k] <- mu[i] + d[t[i,k]] - d[t[i,1]] # model for linear predictor } } d[1]<-0 # treatment effect is zero for reference treatment for (k in 2:nt){ d[k] ~ dnorm(0,.0001) } # vague priors for treatment effects } " # Initial Values inits1 <- list("d"=c(NA, 0,0,0,0), "mu"=c(0, 0, 0, 0, 0, 0, 0)) inits2 <- list("d"=c(NA, -1,-3,-1,1), "mu"=c(-3, -3, -3, -3, -3, -3, -3)) inits3 <- list("d"=c(NA, 2,2,2,2), "mu"=c(-3, 5, -1, -3, 7, -3, -4)) inits <- list(inits1, inits2, inits3) t<-matrix(nrow=7,ncol=3) y<-matrix(nrow=7,ncol=3) se<-matrix(nrow=7,ncol=3) t[,1] <- c(1,1,1,3,3,4,4) t[,2] <- c(3,2,2,4,4,5,5) t[,3] <- c(NA,NA,4,NA,NA,NA,NA) y[,1] <- c(-1.22,-0.7,-0.3,-0.24,-0.73,-2.2,-1.8) y[,2] <- c(-1.53,-2.4,-2.6,-0.59,-0.18,-2.5,-2.1) y[,3] <- c(NA,NA,-1.2,NA,NA,NA,NA) se[,1] <- c(0.504,0.282,0.505,0.265,0.335,0.197,0.2) se[,2] <- c(0.439,0.258,0.51,0.354,0.442,0.19,0.25) se[,3] <- c(NA,NA,0.478,NA,NA,NA,NA) na <- c(2,2,3,2,2,2,2) datalist <- list(nt=5,t=t,y=y,se=se,ns=7,na=na) results <- run.jags(model=jags.MTC, n.chains=3, inits=inits,sample = 20000,burnin = 10000, method="rjparallel", data=datalist,monitor=c("d"))

It compiles then sends out the following message

"Starting the rjags simulations using a socket cluster with 3 nodes on host ‘localhost’

Error in checkForRemoteErrors(val) :

3 nodes produced errors; first error: RUNTIME ERROR:

Compilation error on line 11.

d[1] is a logical node and cannot be observed"

As my programming seems in line with the advice on page 8 of the JAGS 3.4 manual as regards setting parameters to 0 and using NA in the initial values I'm not sure what is it I'm doing wrong. Any help much appreciated.

Steve