model { # Set up data for(i in 1:N) { for(j in 1:T) { # risk set = 1 if obs.t >= t Y[i,j] <- step(obs.t[i] - t[j] + eps) # counting process jump = 1 if obs.t in [ t[j], t[j+1] ) # i.e. if t[j] <= obs.t < t[j+1] dN[i, j] <- Y[i, j] * step(t[j + 1] - obs.t[i] - eps) * FAIL[i] } } # Model for(j in 1:T) { for(i in 1:N) { dN[i, j] ~ dpois(Idt[i, j]) # Likelihood Idt[i, j] <- Y[i, j] * exp(beta0 + beta[1] * Primaries[i] + beta[2]*Age[i] + beta[3]*Black[i] + W[CoRes[i]] ) * dL0[j] # Intensity } dL0[j] ~ dgamma(mu[j], c) mu[j] <- dL0.star[j] * c # prior mean hazard # Survivor function = exp(-Integral{l0(u)du})^exp(beta0+beta*z) S.treat[j] <- pow(exp(-sum(dL0[1 : j])), exp(beta0+beta[1] * 1)); S.placebo[j] <- pow(exp(-sum(dL0[1 : j])), exp(beta0 + beta1 * 0)); } W[1:regions] ~ car.normal(adj[],weights[],num[],tau) W.mean <- mean(W[]) c ~ dgamma(0.0001, 0.00001) r ~ dgamma(0.001, 0.0001) for (j in 1 : T) { dL0.star[j] <- r * (t[j + 1] - t[j]) } for(i in 1:3) {beta[i] ~ dnorm(0.0,0.00001)} beta0 ~ dnorm(0.0,0.001) } #INITS list(W=c(0,0,0,...,0),beta =c(0,0,0),beta0=0, dL0=c(1, 1, 1, ..., 1), tau=1.0, c=1.0,r=1.0) #DataStepSurv - Setting up survival component of data - including vector of survival times list(t=c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 83, 84, 85), T=80, N=2122, eps=0.0) #DataStepSpatial - reading adjacency structure and spatial component of data list(regions=99, nsum=444, adj=c(2, 15, 39,...,46, 94),num = c(5, 5, 2,..., 3, 5)) #DataStepResponseCovariates - Reading the survival times, death indicator and covariates. obs.t[] FAIL[] Primaries[] Age[] Black[] CoRes[] 80 0 1 73 0 0 0 71 82 0 1 62 0 0 0 82 82 0 1 65 0 0 0 57 ......................... ......................... ......................... 35 1 1 82 0 0 0 55 75 1 1 74 0 0 0 38 81 0 1 83 0 0 0 57 #End of .odc file