data { cadj <- 100000 for(i in 1 : N ) { zeros[i] <- 0 } } model{ for(i in 1 : N) { ###joint model### #### hazard mu[i]<-exp(alpha[ext[i]]+beta2*trt[i]) #control arm: trt[i]==0, treatment arm: trt[i]==1, HC: ext=2, Trial: ext=1 l[i] <- r0*mu[i]*pow(timev[i],r0-1) #### cumulative hazard HL[i] <- mu[i] * pow(timev[i],r0) L[i] <- pow(l[i], event[i]) * exp(-HL[i]) #censor: event[i]==0 phi[i] <- -log (L[i]) + cadj zeros[i] ~ dpois( phi[i] ) # likelihood is exp(-phi[i]) } ### prior alpha[1] ~ dnorm(alpha[2],tau) alpha[2] ~ dnorm(0, 0.001) #historical parameter beta2 ~ dnorm(0, 1) sigma ~ dt(0, 25, 1) tau<- 1/(sigma^2) r0 ~ dexp(1) HR_trt_cc=exp(beta2) HR_cc_hc=exp(alpha[1]-alpha[2]) cc_hc=alpha[1]-alpha[2] }