#Ex 9.2 TACTIC - Turbohaler example model { # set up treatment indicator for (i in 1:58){ treat[i]<-1 } for (i in 59:120){ treat[i]<-2 } for(j in 1:120) { e[j] <- step(r[j]+0.001) # e = 0 if r is negative (exac) , 1 otherwise (no exac) eplus1[j]<-e[j]+1 # just so that can be used as an index in WinBUGS logc[j] <- log(c[j]) # use log costs e[j] ~ dbern(phi[treat[j]]) logc[j] ~ dnorm(lambda[treat[j],eplus1[j]], prec[ treat[j] , eplus1[j] ] ) } # Calculate means costs for (i in 1:2){ mc[i] <- (1-phi[i])*exp(lambda[i,1]+sigma2[i,1]/2) + phi[i]*exp(lambda[i,2]+sigma2[i,2]/2) } # incremental costs and effectiveness theta.c <- mc[2] - mc[1] theta.e <- phi[2] - phi[1] # Calculate cost-effectiveness measures for(k in 1:21) { K[k] <- (k-1)*500 INB[k] <- K[k] * theta.e - theta.c Q[k] <- step( INB[k]) } effic <- step(theta.e) cheap <- step(-theta.c) dominant <- effic * cheap # prior distributions for(i in 1:2){ phi[i] ~ dunif(0,1) # exacerbation rates for (j in 1:2){ lambda[i, j] ~ dunif(-10,100) # mean of log-costs if no exac / exac. # sigma[i, j] ~ dunif(0,100) # sd of log-costs if no exac. /exac # exchangeable log(sigmas) log(sigma[i,j] )<- logsigma[i,j] logsigma[i,j] ~ dnorm(mu.sigma,tau2inv.sigma) sigma2[i, j]<-sigma[i,j]*sigma[i,j] prec[i, j]<-1/sigma2[i,j] } } mu.sigma~dunif(-10,10) tau.sigma ~ dunif(0,10) tau2inv.sigma<- 1/(tau.sigma*tau.sigma) }