Cox model
Leukemia data

MODEL

model{	
# Set up the a[j]s
#  d[1]=0; {d[j]: j = 2,...,k} are distinct death times if
#  last observation is a death;  else, d[k] is last censored time
#  Dimension of vector d is k
 a[1] <- 0
 for(i in 2:k){a[i] <- (d[i-1] + d[i])/2}
 a[k+1] <- d[k] + (d[k] - d[k-1])/2
 # d[j] is in (a[j], a[j+1]) j=2,...,k

# Construct H[i,j] and N[i,j]
 for(i in 1:n){
   for(j in 1:k){
     HH[i,j] <- step(y[i]-a[j])
     H[i,j] <- HH[i,j]*(min(y[i],a[j+1])-a[j])
     N[i,j] <- HH[i,j]*step(a[j+1]-y[i])*delta[i]
# Equals 1 iff y[i] is in interval j and delta[i]=1
   }
 }
# Likelihood Construction
 for(i in 1:n){
   mu[i] <-  beta[1]*(AGgroup[i])
   for(j in 1:k){
     N[i,j] ~ dpois(theta[i,j])
     theta[i,j] <- exp(mu[i])*H[i, j]*lam[j]   
   }
 }
# Prior for lambdas
 lamm <-  (10000)*(0.01) # exp(-a[2]*0.01) = 0.995
 lam[1] ~ dgamma(lamm,10000) # lam1 is "fixed" at 0.01
 for(j in 2:k){  # prior on baseline hazard bits
   f[j] <- w*(a[j+1]-a[j])
   e[j] <- lamstar*f[j]
   lam[j] ~ dgamma(e[j],f[j])
 }
 lamstar <- 0.05   #  Select value or set prior for lamstar
#  lamstar ~ dgamma(a,ww)   a=0.05*ww    ww=0.01

#  Inferences for survival functions
 for(j in 1:k){
   dH0[j] <- (a[j+1]-a[j])* lam[j]   # (H_0(a[j+1]) -  H_0(a[j]))
# Survivor function at a[j+1] = exp{-H_0(a[j+1])exp(mu)}
# Surv Fn for AG+ and AG- groups
   S.pos[j] <- pow(exp(-sum(dH0[1:j])), exp(beta[1]))
   S.neg[j] <- pow(exp(-sum(dH0[1:j])), 1)
   S.diff[j] <- S.pos[j] - S.neg[j]
 }
#  Inferences for the HRs and prior on the betas
 for(j in 1:1){
   HR[j] <- exp(beta[j]) # relative hazard
   beta[j] ~ dnorm(0,0.000001)
 }
}

# Data.  All data are deaths; 22 distinct death times
# AGgroup=1 for AG+ and is 0 for AG-
list(n=33, k=23, w=0.01, 
y=c(65,156,100,134,16,108,121,4,39,143,56,26,22,1,1,5,65, 
    56,65,17,7,16,22,3,4,2,3,8,4,3,30,4,43),	
AGgroup=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 
         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
delta=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),
d=c(0,1,2,3,4,5,7,8,16,17,22,26,30,39,43,
    56,65,100,108,121,134,143,156))
#  Initial Values.  23 lambdas and 1 beta
list(beta=c(0), # lamstar = 0.05,
lam=c(0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,
      0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1) ) 

RESULTS

	 node	 mean	 sd	 MC error	2.5%	median	97.5%	start	sample
	HR[1]	0.2988	0.1321	6.64E-4	0.1155	0.2747	0.6218	10001	199998
	S.diff[1]	0.003491	7.487E-4	3.39E-6	0.001833	0.003551	0.004788	10001	199998
	S.diff[2]	0.06632	0.04524	1.311E-4	0.009574	0.05619	0.1795	10001	199998
	S.diff[3]	0.09601	0.05475	1.741E-4	0.0192	0.08622	0.2277	10001	199998
	S.diff[4]	0.1819	0.07605	2.893E-4	0.05537	0.1746	0.3487	10001	199998
	S.diff[5]	0.2843	0.0966	4.235E-4	0.1035	0.2815	0.4799	10001	199998
	S.diff[6]	0.3068	0.1007	4.52E-4	0.1138	0.3052	0.5067	10001	199998
	S.diff[7]	0.3273	0.1043	4.824E-4	0.1238	0.3271	0.531	10001	199998
	S.diff[8]	0.3477	0.1081	5.125E-4	0.1332	0.3488	0.5553	10001	199998
	S.diff[9]	0.3805	0.114	5.633E-4	0.1482	0.3839	0.5934	10001	199998
	S.diff[10]	0.3954	0.1169	5.838E-4	0.1549	0.3998	0.611	10001	199998
	S.diff[11]	0.417	0.1215	6.162E-4	0.164	0.4224	0.6374	10001	199998
	S.diff[12]	0.4237	0.1232	6.26E-4	0.1666	0.4295	0.6462	10001	199998
	S.diff[13]	0.4274	0.1246	6.32E-4	0.1684	0.4334	0.6532	10001	199998
	S.diff[14]	0.4278	0.1255	6.328E-4	0.1682	0.4333	0.6565	10001	199998
	S.diff[15]	0.4242	0.126	6.28E-4	0.1661	0.429	0.6558	10001	199998
	S.diff[16]	0.404	0.125	5.981E-4	0.1563	0.4058	0.6408	10001	199998
	S.diff[17]	0.3062	0.1111	4.174E-4	0.1088	0.3	0.5381	10001	199998
	S.diff[18]	0.2668	0.1039	3.433E-4	0.08943	0.2585	0.4894	10001	199998
	S.diff[19]	0.2213	0.09587	2.715E-4	0.0658	0.2111	0.4337	10001	199998
	S.diff[20]	0.175	0.08635	2.111E-4	0.04239	0.1632	0.3731	10001	199998
	S.diff[21]	0.1281	0.075	1.546E-4	0.02245	0.1147	0.307	10001	199998
	S.diff[22]	0.07639	0.05957	1.209E-4	0.005311	0.06188	0.2282	10001	199998
	S.diff[23]	0.02689	0.03601	7.196E-5	3.672E-5	0.0131	0.1297	10001	199998
	S.neg[1]	0.995	4.975E-4	1.115E-6	0.994	0.995	0.9959	10001	199998
	S.neg[2]	0.905	0.06001	1.389E-4	0.7572	0.9175	0.9837	10001	199998
	S.neg[3]	0.8615	0.07125	1.718E-4	0.6946	0.873	0.9657	10001	199998
	S.neg[4]	0.7312	0.0928	2.398E-4	0.5303	0.7389	0.8887	10001	199998
	S.neg[5]	0.5619	0.1057	3.006E-4	0.3493	0.5643	0.7597	10001	199998
	S.neg[6]	0.5215	0.1067	3.096E-4	0.3115	0.5227	0.7247	10001	199998
	S.neg[7]	0.4826	0.1068	3.167E-4	0.2759	0.4827	0.6901	10001	199998
	S.neg[8]	0.4421	0.1067	3.268E-4	0.2397	0.4405	0.6526	10001	199998
	S.neg[9]	0.3696	0.1037	3.377E-4	0.1805	0.3655	0.5818	10001	199998
	S.neg[10]	0.3314	0.1018	3.367E-4	0.1501	0.3258	0.5442	10001	199998
	S.neg[11]	0.2618	0.09559	3.337E-4	0.09986	0.2538	0.469	10001	199998
	S.neg[12]	0.2296	0.09144	3.194E-4	0.07963	0.2204	0.4317	10001	199998
	S.neg[13]	0.1982	0.08672	3.096E-4	0.06064	0.1875	0.3945	10001	199998
	S.neg[14]	0.1695	0.08135	3.017E-4	0.04515	0.158	0.3572	10001	199998
	S.neg[15]	0.1411	0.0755	2.839E-4	0.03117	0.1288	0.3192	10001	199998
	S.neg[16]	0.09267	0.06232	2.469E-4	0.01248	0.07926	0.2481	10001	199998
	S.neg[17]	0.03165	0.03712	1.555E-4	2.956E-4	0.01871	0.1353	10001	199998
	S.neg[18]	0.02139	0.0297	1.252E-4	5.687E-5	0.01024	0.1062	10001	199998
	S.neg[19]	0.01337	0.02243	9.571E-5	5.742E-6	0.004643	0.07817	10001	199998
	S.neg[20]	0.007861	0.01613	6.643E-5	3.439E-7	0.00174	0.054	10001	199998
	S.neg[21]	0.004186	0.01092	4.298E-5	7.084E-9	4.634E-4	0.03357	10001	199998
	S.neg[22]	0.001672	0.006174	2.281E-5	4.023E-12	4.645E-5	0.01532	10001	199998
	S.neg[23]	3.642E-4	0.002528	7.604E-6	3.689E-22	1.398E-7	0.003167	10001	199998
	S.pos[1]	0.9985	6.782E-4	3.339E-6	0.9969	0.9986	0.9994	10001	199998
	S.pos[2]	0.9713	0.02172	6.153E-5	0.9148	0.9769	0.996	10001	199998
	S.pos[3]	0.9575	0.02753	8.287E-5	0.8873	0.9639	0.9918	10001	199998
	S.pos[4]	0.9131	0.04332	1.461E-4	0.8085	0.9208	0.974	10001	199998
	S.pos[5]	0.8463	0.06271	2.332E-4	0.7009	0.8551	0.9424	10001	199998
	S.pos[6]	0.8283	0.06732	2.533E-4	0.6736	0.8372	0.933	10001	199998
	S.pos[7]	0.81	0.07179	2.703E-4	0.6469	0.8188	0.9236	10001	199998
	S.pos[8]	0.7898	0.07651	2.891E-4	0.6172	0.7985	0.9128	10001	199998
	S.pos[9]	0.7501	0.08475	3.214E-4	0.5633	0.7583	0.8908	10001	199998
	S.pos[10]	0.7268	0.0893	3.41E-4	0.532	0.7347	0.8776	10001	199998
	S.pos[11]	0.6788	0.09745	3.716E-4	0.4712	0.6857	0.8486	10001	199998
	S.pos[12]	0.6533	0.1013	3.868E-4	0.44	0.6594	0.8323	10001	199998
	S.pos[13]	0.6256	0.1049	3.977E-4	0.408	0.631	0.8136	10001	199998
	S.pos[14]	0.5974	0.1082	4.049E-4	0.3767	0.6017	0.7944	10001	199998
	S.pos[15]	0.5654	0.1112	4.119E-4	0.3425	0.5684	0.7716	10001	199998
	S.pos[16]	0.4967	0.1149	4.111E-4	0.2748	0.4966	0.7184	10001	199998
	S.pos[17]	0.3379	0.1106	3.163E-4	0.1432	0.3313	0.5698	10001	199998
	S.pos[18]	0.2882	0.1047	2.699E-4	0.1107	0.2796	0.5133	10001	199998
	S.pos[19]	0.2347	0.09742	2.275E-4	0.07668	0.2241	0.4502	10001	199998
	S.pos[20]	0.1828	0.08809	1.907E-4	0.04753	0.1707	0.3847	10001	199998
	S.pos[21]	0.1323	0.07656	1.48E-4	0.02434	0.1186	0.315	10001	199998
	S.pos[22]	0.07806	0.06066	1.226E-4	0.005614	0.06321	0.2326	10001	199998
	S.pos[23]	0.02725	0.0365	7.299E-5	3.984E-5	0.01325	0.1316	10001	199998
	beta[1]	-1.299	0.4291	0.002191	-2.159	-1.292	-0.4751	10001	199998
	lam[1]	0.009989	0.001	2.24E-6	0.008121	0.009955	0.01205	10001	199998
	lam[2]	0.09715	0.06953	1.613E-4	0.0115	0.0811	0.2731	10001	199998
	lam[3]	0.05056	0.05106	1.153E-4	0.001268	0.03467	0.189	10001	199998
	lam[4]	0.169	0.09945	2.497E-4	0.03426	0.1496	0.4131	10001	199998
	lam[5]	0.2737	0.1415	3.622E-4	0.07209	0.2493	0.6138	10001	199998
	lam[6]	0.05212	0.05277	1.233E-4	0.001308	0.03582	0.194	10001	199998
	lam[7]	0.05418	0.0549	1.27E-4	0.001335	0.03719	0.2034	10001	199998
	lam[8]	0.02064	0.02097	4.948E-5	5.151E-4	0.01416	0.07759	10001	199998
	lam[9]	0.04229	0.03083	8.099E-5	0.004924	0.03502	0.1212	10001	199998
	lam[10]	0.03923	0.04	9.429E-5	9.76E-4	0.02675	0.1476	10001	199998
	lam[11]	0.05708	0.04212	1.077E-4	0.006607	0.04695	0.1649	10001	199998
	lam[12]	0.03632	0.03726	8.77E-5	8.941E-4	0.02469	0.1373	10001	199998
	lam[13]	0.02544	0.02616	6.408E-5	6.349E-4	0.01728	0.09623	10001	199998
	lam[14]	0.02732	0.02832	7.002E-5	6.618E-4	0.01839	0.1038	10001	199998
	lam[15]	0.02522	0.02632	6.317E-5	6.236E-4	0.01698	0.09627	10001	199998
	lam[16]	0.04657	0.03561	1.027E-4	0.005185	0.03764	0.1388	10001	199998
	lam[17]	0.07406	0.05397	1.926E-4	0.01211	0.06062	0.2135	10001	199998
	lam[18]	0.03224	0.03832	1.172E-4	6.919E-4	0.01987	0.1359	10001	199998
	lam[19]	0.08718	0.1037	3.159E-4	0.001925	0.05391	0.3664	10001	199998
	lam[20]	0.08769	0.1041	3.337E-4	0.001863	0.05427	0.3681	10001	199998
	lam[21]	0.1395	0.1659	5.205E-4	0.002973	0.0863	0.586	10001	199998
	lam[22]	0.2523	0.2988	8.94E-4	0.005445	0.1567	1.052	10001	199998
	lam[23]	0.5733	0.6666	0.002131	0.01273	0.3585	2.378	10001	199998