data {
      cadj <- 100000
      for(i in 1 : N ) {zeros[i] <- 0}
      }

model{

   for(i in 1 : N) {

      ### likelihood
      mu[i] <- exp(alpha[ext[i]] + inprod(x[i, ], beta)) # hc: ext[i] = 2, alpha[2]; internal: ext[i] = 1, alpha[1]
      l[i] <- r0 * pow(timev[i], r0-1) * mu[i] # hazard

      HL[i] <- mu[i] * pow(timev[i], r0) # cumulative hazard

      L[i] <- pow(l[i], event[i]) * exp(-HL[i]) #censor: event[i]==0 # Likelihood presented with Poisson

      phi[i] <-  -log (L[i]) + cadj

      zeros[i] ~ dpois( phi[i] )     # likelihood is exp(-phi[i])
      }


      ### prior
      for(j in 1 : (n_cov+1)){beta[j] ~ dnorm(0.0, .0001)}
      r0 ~ dexp(.0001)

	    alpha[2] ~ dnorm(0, .0001) #historical parameter
      alpha[1] ~ dnorm(alpha[2], tau)


      ### hyper-prior
      tau ~ dgamma(1, 0.001) # gamma


      ### output
      HR_trt_cc=exp(beta[1])
      HR_cc_hc=exp(alpha[2]-alpha[1])
      cc_hc=alpha[2]-alpha[1]

      }

