Response variable:  Time to death or on-study time, months 
Predictor variables:  
  Stage of disease (1=stage 1, 2=stage2, 3=stage 3, 4=stage 4) 
  Age at diagnosis of larynx cancer 
  Year of diagnosis of larynx cancer 
Death indicator (0=alive, 1=dead)  
Reference: Kardaun Stat. Nederlandica 37 (1983), 103-126.

 
1.  Log normal regression
     Example 13.1.1

Model

model{ 
 for(i in 1:106){
   sAge[i] <- (age[i]-mean(age[ ]))/sd(age[ ]) 
   sYr[i] <- (Yr[i]-mean(Yr[ ]))/sd(Yr[ ]) 
   t[i] ~ dlnorm(mu[i], tau) I(c[i] , ) 
   mu[i] <- beta[1] + beta[2]*equals(stage[i],2) + beta[3]*equals(stage[i],3)  + beta[4]*equals(stage[i],4) + beta[5]*sAge[i] + beta[6]*sYr[i]          
# 5 month survival probabilities using covariates in the data
    S[i] <-   1- phi((log(5) - mu[i] )*sqrt(tau))  
# Medians corresponding to the covariates in the data
    med[i] <- exp(mu[i])
 }
 for (i in 1:6){
   beta[i] ~ dnorm(0,0.000001)
# RM's for each variable    
    rm[i] <- exp(beta[i])
    prob[i] <- step(beta[i])
 }
 tau ~ dgamma(0.001,0.001)   
 sigma <- sqrt(1/tau)  
}
list(beta=c(0,0,0,0,0,0),tau=1)

DATA AND INITS

list(beta=c(0,0,0,0,0,0),tau=1)

stage[ ] t[ ] age[ ] Yr[ ] c[ ]
1 0.6 77 76 0
1 1.3 53 71 0
1 2.4 45 71 0
1 NA 57 78 2.5
1 3.2 58 74 0
1 NA 51 77 3.2
1 3.3 76 74 0
1 NA 63 77 3.3
1 3.5 43 71 0
1 3.5 60 73 0
1 4 52 71 0
1 4 63 76 0
1 4.3 86 74 0
1 NA 48 76 4.5
1 NA 68 76 4.5
1 5.3 81 72 0
1 NA 70 75 5.5
1 NA 58 75 5.9
1 NA 47 75 5.9
1 6 75 73 0
1 NA 77 75 6.1
1 NA 64 75 6.2
1 6.4 77 72 0
1 6.5 67 70 0
1 NA 79 74 6.5
1 NA 61 74 6.7
1 NA 66 74 7
1 7.4 68 71 0
1 NA 73 73 7.4
1 NA 56 73 8.1
1 NA 73 73 8.1
1 NA 58 71 9.6
1 NA 68 70 10.7
2 0.2 86 74 0
2 1.8 64 77 0
2 2 63 75 0
2 NA 71 78 2.2
2 NA 67 78 2.6
2 NA 51 77 3.3
2 3.6 70 77 0
2 NA 72 77 3.6
2 4 81 71 0
2 NA 47 76 4.3
2 NA 64 76 4.3
2 NA 66 76 5
2 6.2 74 72 0
2 7 62 73 0
2 NA 50 73 7.5
2 NA 53 73 7.6
2 NA 61 71 9.3
3 0.3 49 72 0
3 0.3 71 76 0
3 0.5 57 74 0
3 0.7 79 77 0
3 0.8 82 74 0
3 1 49 76 0
3 1.3 60 76 0
3 1.6 64 72 0
3 1.8 74 71 0
3 1.9 72 74 0
3 1.9 53 74 0
3 3.2 54 75 0
3 3.5 81 74 0
3 NA 52 77 3.7
3 NA 66 76 4.5
3 NA 54 76 4.8
3 NA 63 76 4.8
3 5 59 73 0
3 NA 49 76 5
3 NA 69 76 5.1
3 6.3 70 72 0
3 6.4 65 72 0
3 NA 65 74 6.5
3 7.8 68 72 0
3 NA 78 73 8
3 NA 69 71 9.3
3 NA 51 71 10.1
4 0.1 65 72 0
4 0.3 71 76 0
4 0.4 76 77 0
4 0.8 65 76 0
4 0.8 78 77 0
4 1 41 77 0
4 1.5 68 73 0
4 2 69 76 0
4 2.3 62 71 0
4 NA 74 78 2.9
4 3.6 71 75 0
4 3.8 84 74 0
4 NA 48 76 4.3
1 NA 50 71 0
1 NA 50 77 0
1 NA 70 71 0
1 NA 70 77 0
2 NA 50 71 0
2 NA 50 77 0
2 NA 70 71 0
2 NA 70 77 0
3 NA 50 71 0
3 NA 50 77 0
3 NA 70 71 0
3 NA 70 77 0
4 NA 50 71 0
4 NA 50 77 0
4 NA 70 71 0
4 NA 70 77 0
END

RESULTS

log normal
Dbar = post.mean of -2logL; Dhat = -2LogL at post.mean of stochastic nodes
			Dbar			Dhat			pD		DIC	
t			290.136	282.962	7.174	297.309	
total	290.136	282.962	7.174	297.309	

 node	 mean	 sd	 MC error	2.5%	median	97.5%	start	sample
	 node	 mean	 sd	 MC error	2.5%	median	97.5%	start	sample
	prob[1]	1.0	0.0	3.162E-13	1.0	1.0	1.0	10001	100000
	prob[2]	0.3085	0.4619	0.003	0.0	0.0	1.0	10001	100000
	prob[3]	0.00869	0.09281	3.745E-4	0.0	0.0	0.0	10001	100000
	prob[4]	9.0E-5	0.009486	3.283E-5	0.0	0.0	0.0	10001	100000
	prob[5]	0.08779	0.283	0.001005	0.0	0.0	1.0	10001	100000
	prob[6]	0.7395	0.4389	0.00234	0.0	1.0	1.0	10001	100000
	S[1]	0.6465	0.1041	9.591E-4	0.4311	0.6516	0.8343	10001	100000
	S[2]	0.7039	0.09153	5.663E-4	0.5082	0.7102	0.8627	10001	100000
	S[3]	0.7389	0.1011	5.675E-4	0.5152	0.7493	0.9043	10001	100000
	S[4]	0.763	0.1049	9.735E-4	0.5284	0.7752	0.9302	10001	100000
	S[5]	0.7193	0.07326	7.067E-4	0.5654	0.7236	0.8504	10001	100000
	S[6]	0.7788	0.09603	8.683E-4	0.5628	0.7903	0.9316	10001	100000
	S[7]	0.6262	0.08839	7.923E-4	0.4455	0.6288	0.7892	10001	100000
	S[8]	0.7283	0.0963	9.478E-4	0.5216	0.7356	0.8924	10001	100000
	S[9]	0.7469	0.1037	5.69E-4	0.5151	0.7586	0.9141	10001	100000
	S[10]	0.6973	0.0721	6.517E-4	0.5469	0.7007	0.8278	10001	100000
	S[11]	0.7085	0.09255	5.659E-4	0.5096	0.7153	0.8679	10001	100000
	S[12]	0.7182	0.08579	8.733E-4	0.5371	0.7234	0.8694	10001	100000
	S[13]	0.5698	0.1158	8.546E-4	0.3382	0.5725	0.7844	10001	100000
	S[14]	0.7818	0.09076	7.914E-4	0.5788	0.7923	0.9273	10001	100000
	S[15]	0.6937	0.0894	9.034E-4	0.5077	0.6984	0.8536	10001	100000
	S[16]	0.5696	0.1044	7.069E-4	0.3603	0.5719	0.7654	10001	100000
	S[17]	0.6717	0.08277	8.356E-4	0.5012	0.6749	0.8231	10001	100000
	S[18]	0.7307	0.07771	7.743E-4	0.5666	0.7355	0.8677	10001	100000
	S[19]	0.7765	0.08699	7.294E-4	0.5836	0.7858	0.9185	10001	100000
	S[20]	0.6179	0.08557	7.185E-4	0.4432	0.6206	0.7771	10001	100000
	S[21]	0.6339	0.09575	8.763E-4	0.4384	0.6376	0.809	10001	100000
	S[22]	0.7023	0.07752	8.034E-4	0.5408	0.7057	0.8427	10001	100000
	S[23]	0.5923	0.09443	6.798E-4	0.4009	0.5949	0.7685	10001	100000
	S[24]	0.6182	0.1018	5.983E-4	0.4094	0.6223	0.8036	10001	100000
	S[25]	0.6094	0.09575	8.103E-4	0.4145	0.6121	0.7861	10001	100000
	S[26]	0.705	0.07204	7.179E-4	0.5549	0.7084	0.8357	10001	100000
	S[27]	0.6799	0.07315	7.394E-4	0.5292	0.6826	0.8146	10001	100000
	S[28]	0.6276	0.08913	6.022E-4	0.4441	0.6312	0.7913	10001	100000
	S[29]	0.629	0.08152	7.071E-4	0.4621	0.6316	0.7805	10001	100000
	S[30]	0.7164	0.07485	6.41E-4	0.5584	0.7209	0.8493	10001	100000
	S[31]	0.629	0.08152	7.071E-4	0.4621	0.6316	0.7805	10001	100000
	S[32]	0.6798	0.08762	5.717E-4	0.4963	0.6847	0.8355	10001	100000
	S[33]	0.6127	0.1025	6.027E-4	0.4027	0.6166	0.7999	10001	100000
	S[34]	0.5024	0.1352	6.287E-4	0.244	0.5021	0.7624	10001	100000
	S[35]	0.6629	0.1138	6.147E-4	0.4263	0.6697	0.8636	10001	100000
	S[36]	0.6428	0.1055	5.468E-4	0.4264	0.6474	0.8341	10001	100000
	S[37]	0.6387	0.1272	6.876E-4	0.3763	0.6461	0.8628	10001	100000
	S[38]	0.6593	0.1235	6.809E-4	0.4017	0.6672	0.8745	10001	100000
	S[39]	0.7238	0.1159	6.2E-4	0.4719	0.7349	0.9153	10001	100000
	S[40]	0.6318	0.1178	6.202E-4	0.3906	0.6373	0.8434	10001	100000
	S[41]	0.6211	0.1199	6.236E-4	0.3765	0.6264	0.8376	10001	100000
	S[42]	0.4875	0.1441	7.959E-4	0.2146	0.4866	0.7654	10001	100000
	S[43]	0.7301	0.1156	5.898E-4	0.4772	0.742	0.9197	10001	100000
	S[44]	0.6506	0.1082	5.683E-4	0.4279	0.6562	0.8448	10001	100000
	S[45]	0.6402	0.1089	5.687E-4	0.4174	0.6453	0.8367	10001	100000
	S[46]	0.5404	0.1258	6.866E-4	0.2929	0.5418	0.7773	10001	100000
	S[47]	0.6204	0.1117	5.964E-4	0.3924	0.625	0.8244	10001	100000
	S[48]	0.6803	0.119	6.062E-4	0.427	0.6897	0.8843	10001	100000
	S[49]	0.6661	0.1162	6.018E-4	0.4214	0.674	0.8692	10001	100000
	S[50]	0.5966	0.131	7.47E-4	0.331	0.6019	0.8351	10001	100000
	S[51]	0.4821	0.1112	4.828E-4	0.2697	0.481	0.6997	10001	100000
	S[52]	0.4162	0.09798	4.845E-4	0.2345	0.4131	0.6142	10001	100000
	S[53]	0.4656	0.08842	3.84E-4	0.2967	0.4644	0.6412	10001	100000
	S[54]	0.3883	0.1187	5.937E-4	0.1753	0.3828	0.6326	10001	100000
	S[55]	0.3307	0.1005	4.063E-4	0.1542	0.3243	0.5424	10001	100000
	S[56]	0.5398	0.1138	5.845E-4	0.3162	0.5409	0.7568	10001	100000
	S[57]	0.4779	0.09784	5.126E-4	0.2906	0.4765	0.6713	10001	100000
	S[58]	0.3976	0.08968	4.071E-4	0.2312	0.3951	0.5788	10001	100000
	S[59]	0.3323	0.1015	4.999E-4	0.1538	0.326	0.5464	10001	100000
	S[60]	0.3817	0.08546	3.539E-4	0.2242	0.3788	0.5561	10001	100000
	S[61]	0.4884	0.09547	4.159E-4	0.3048	0.4877	0.6765	10001	100000
	S[62]	0.4974	0.09709	4.611E-4	0.3107	0.4968	0.6875	10001	100000
	S[63]	0.3356	0.09876	3.997E-4	0.1611	0.3296	0.5425	10001	100000
	S[64]	0.5372	0.1188	6.636E-4	0.3053	0.538	0.7637	10001	100000
	S[65]	0.444	0.09571	4.906E-4	0.2637	0.4419	0.6353	10001	100000
	S[66]	0.5119	0.105	5.48E-4	0.3083	0.5116	0.7158	10001	100000
	S[67]	0.4609	0.09609	4.997E-4	0.2787	0.4592	0.6517	10001	100000
	S[68]	0.4396	0.08711	3.693E-4	0.2746	0.438	0.6134	10001	100000
	S[69]	0.5398	0.1138	5.845E-4	0.3162	0.5409	0.7568	10001	100000
	S[70]	0.4272	0.09666	4.856E-4	0.2471	0.4246	0.6217	10001	100000
	S[71]	0.3652	0.09022	4.103E-4	0.2012	0.3615	0.5508	10001	100000
	S[72]	0.3921	0.08939	4.063E-4	0.2268	0.3893	0.5734	10001	100000
	S[73]	0.4202	0.08189	3.482E-4	0.2661	0.418	0.5843	10001	100000
	S[74]	0.3758	0.08945	4.072E-4	0.2119	0.3726	0.5588	10001	100000
	S[75]	0.3372	0.09378	3.903E-4	0.1704	0.3322	0.5337	10001	100000
	S[76]	0.3577	0.09918	4.921E-4	0.1796	0.3527	0.5626	10001	100000
	S[77]	0.4567	0.1161	5.408E-4	0.238	0.4548	0.6858	10001	100000
	S[78]	0.1643	0.08443	4.132E-4	0.042	0.1502	0.3644	10001	100000
	S[79]	0.177	0.08033	3.698E-4	0.05481	0.1655	0.3624	10001	100000
	S[80]	0.1703	0.08489	3.95E-4	0.04548	0.157	0.3697	10001	100000
	S[81]	0.1994	0.08578	4.13E-4	0.06615	0.1881	0.396	10001	100000
	S[82]	0.1639	0.08437	3.854E-4	0.04144	0.15	0.3633	10001	100000
	S[83]	0.3251	0.1458	7.508E-4	0.08904	0.3102	0.6429	10001	100000
	S[84]	0.161	0.07794	3.63E-4	0.04596	0.1488	0.3442	10001	100000
	S[85]	0.1842	0.08178	3.827E-4	0.05889	0.1729	0.3723	10001	100000
	S[86]	0.1685	0.09349	4.766E-4	0.03692	0.1517	0.3933	10001	100000
	S[87]	0.1884	0.095	4.779E-4	0.04839	0.1736	0.4109	10001	100000
	S[88]	0.1673	0.07607	3.382E-4	0.05217	0.1562	0.3441	10001	100000
	S[89]	0.122	0.07164	2.915E-4	0.02522	0.1079	0.2972	10001	100000
	S[90]	0.2761	0.1197	5.986E-4	0.08492	0.2626	0.5432	10001	100000
	S[91]	0.7175	0.09478	5.656E-4	0.5125	0.7253	0.8784	10001	100000
	S[92]	0.7826	0.09644	8.62E-4	0.5648	0.7946	0.9349	10001	100000
	S[93]	0.6167	0.09125	6.117E-4	0.4298	0.6201	0.7853	10001	100000
	S[94]	0.6945	0.1028	9.958E-4	0.4776	0.7011	0.8735	10001	100000
	S[95]	0.6523	0.1368	7.392E-4	0.3638	0.663	0.8863	10001	100000
	S[96]	0.728	0.1165	6.21E-4	0.4737	0.7397	0.919	10001	100000
	S[97]	0.5479	0.1329	7.631E-4	0.2846	0.5503	0.796	10001	100000
	S[98]	0.6318	0.1178	6.202E-4	0.3906	0.6373	0.8434	10001	100000
	S[99]	0.4623	0.1181	5.47E-4	0.2397	0.4606	0.6946	10001	100000
	S[100]	0.5482	0.1219	6.753E-4	0.3088	0.5499	0.7781	10001	100000
	S[101]	0.3525	0.09944	4.931E-4	0.1744	0.3473	0.559	10001	100000
	S[102]	0.4366	0.1098	5.941E-4	0.2322	0.4335	0.657	10001	100000
	S[103]	0.2161	0.1175	5.905E-4	0.0456	0.1965	0.4917	10001	100000
	S[104]	0.279	0.1213	6.347E-4	0.08502	0.2654	0.5498	10001	100000
	S[105]	0.1422	0.0836	4.201E-4	0.02852	0.1258	0.3461	10001	100000
	S[106]	0.1913	0.08807	4.318E-4	0.05736	0.179	0.3938	10001	100000
	beta[1]	2.334	0.3192	0.003535	1.752	2.317	3.01	10001	100000
	beta[2]	-0.2467	0.5103	0.004217	-1.253	-0.247	0.7581	10001	100000
	beta[3]	-0.9693	0.4149	0.003726	-1.806	-0.9614	-0.1747	10001	100000
	beta[4]	-2.015	0.5277	0.0047	-3.09	-2.001	-1.01	10001	100000
	beta[5]	-0.2213	0.1666	7.334E-4	-0.5562	-0.2184	0.09897	10001	100000
	beta[6]	0.1264	0.1949	0.001328	-0.2407	0.1202	0.5228	10001	100000
	med[1]	9.554	4.573	0.04448	3.96	8.552	21.05	10001	100000
	med[2]	11.74	5.014	0.03511	5.148	10.74	24.2	10001	100000
	med[3]	14.3	7.461	0.04849	5.27	12.64	33.14	10001	100000
	med[4]	17.02	11.16	0.1109	5.5	14.19	45.5	10001	100000
	med[5]	12.22	4.518	0.04829	6.245	11.32	23.39	10001	100000
	med[6]	17.96	11.05	0.1091	6.173	15.25	46.19	10001	100000
	med[7]	8.48	3.203	0.03053	4.156	7.871	16.35	10001	100000
	med[8]	13.64	7.209	0.07593	5.378	11.93	31.86	10001	100000
	med[9]	15.05	8.297	0.0529	5.271	13.16	36.05	10001	100000
	med[10]	11.02	3.739	0.03767	5.866	10.33	20.21	10001	100000
	med[11]	12.03	5.253	0.03647	5.176	10.97	25.03	10001	100000
	med[12]	12.58	5.649	0.06185	5.661	11.32	26.85	10001	100000
	med[13]	7.162	3.455	0.02629	2.803	6.43	15.7	10001	100000
	med[14]	17.84	10.23	0.09924	6.521	15.39	43.71	10001	100000
	med[15]	11.34	5.027	0.05426	5.129	10.25	24.01	10001	100000
	med[16]	6.975	2.922	0.02032	3.027	6.416	14.13	10001	100000
	med[17]	10.13	3.907	0.04221	5.021	9.35	19.91	10001	100000
	med[18]	13.05	5.369	0.0586	6.246	11.92	26.48	10001	100000
	med[19]	16.99	8.961	0.08507	6.64	14.9	39.57	10001	100000
	med[20]	8.151	2.9	0.02593	4.111	7.628	15.24	10001	100000
	med[21]	8.888	3.752	0.03638	4.048	8.126	18.19	10001	100000
	med[22]	11.45	4.397	0.04918	5.739	10.55	22.47	10001	100000
	med[23]	7.475	2.844	0.0214	3.523	6.964	14.42	10001	100000
	med[24]	8.336	3.459	0.02089	3.618	7.684	16.91	10001	100000
	med[25]	8.041	3.243	0.02896	3.719	7.406	15.98	10001	100000
	med[26]	11.43	4.027	0.04404	6.025	10.65	21.41	10001	100000
	med[27]	10.29	3.494	0.03827	5.518	9.63	18.91	10001	100000
	med[28]	8.478	3.098	0.02225	4.118	7.927	16.03	10001	100000
	med[29]	8.459	2.899	0.02695	4.39	7.952	15.52	10001	100000
	med[30]	12.06	4.426	0.04289	6.091	11.2	22.95	10001	100000
	med[31]	8.459	2.899	0.02695	4.39	7.952	15.52	10001	100000
	med[32]	10.47	4.06	0.02942	4.933	9.714	20.44	10001	100000
	med[33]	8.171	3.401	0.02045	3.535	7.53	16.58	10001	100000
	med[34]	5.784	3.263	0.01476	1.902	5.035	14.05	10001	100000
	med[35]	10.58	6.038	0.0367	3.899	9.158	25.73	10001	100000
	med[36]	9.446	4.638	0.02633	3.889	8.425	21.15	10001	100000
	med[37]	9.893	6.232	0.03709	3.267	8.378	25.5	10001	100000
	med[38]	10.74	6.795	0.04168	3.588	9.08	27.74	10001	100000
	med[39]	14.32	9.747	0.06058	4.549	11.88	38.8	10001	100000
	med[40]	9.334	5.223	0.03035	3.444	8.116	22.47	10001	100000
	med[41]	8.97	5.035	0.02869	3.274	7.797	21.65	10001	100000
	med[42]	5.55	3.336	0.01726	1.646	4.772	14.02	10001	100000
	med[43]	14.74	10.06	0.06027	4.626	12.25	40.02	10001	100000
	med[44]	9.852	5.111	0.02999	3.916	8.697	22.66	10001	100000
	med[45]	9.441	4.84	0.028	3.775	8.352	21.55	10001	100000
	med[46]	6.52	3.373	0.0175	2.345	5.777	15.04	10001	100000
	med[47]	8.685	4.282	0.02316	3.434	7.749	19.58	10001	100000
	med[48]	11.5	6.834	0.03726	3.885	9.883	28.89	10001	100000
	med[49]	10.68	5.988	0.03272	3.812	9.297	25.96	10001	100000
	med[50]	8.215	4.668	0.02516	2.71	7.135	20.2	10001	100000
	med[51]	5.134	2.266	0.009644	2.157	4.684	10.72	10001	100000
	med[52]	3.981	1.526	0.007348	1.904	3.694	7.724	10001	100000
	med[53]	4.698	1.596	0.006948	2.443	4.42	8.578	10001	100000
	med[54]	3.703	1.823	0.008799	1.427	3.313	8.26	10001	100000
	med[55]	2.891	1.21	0.004807	1.237	2.667	5.832	10001	100000
	med[56]	6.436	3.092	0.01648	2.642	5.759	14.21	10001	100000
	med[57]	4.987	1.925	0.01019	2.419	4.609	9.774	10001	100000
	med[58]	3.665	1.267	0.005766	1.816	3.463	6.684	10001	100000
	med[59]	2.906	1.231	0.006259	1.203	2.684	5.914	10001	100000
	med[60]	3.448	1.136	0.004574	1.795	3.264	6.161	10001	100000
	med[61]	5.149	1.926	0.008525	2.516	4.791	9.893	10001	100000
	med[62]	5.34	2.056	0.01	2.582	4.945	10.41	10001	100000
	med[63]	2.94	1.197	0.004756	1.289	2.722	5.839	10001	100000
	med[64]	6.448	3.273	0.01876	2.539	5.705	14.69	10001	100000
	med[65]	4.394	1.637	0.008309	2.166	4.088	8.427	10001	100000
	med[66]	5.71	2.44	0.01308	2.579	5.205	11.8	10001	100000
	med[67]	4.676	1.757	0.009138	2.303	4.341	9.027	10001	100000
	med[68]	4.265	1.414	0.005925	2.222	4.031	7.666	10001	100000
	med[69]	6.436	3.092	0.01648	2.642	5.759	14.21	10001	100000
	med[70]	4.138	1.559	0.007675	2.012	3.846	7.964	10001	100000
	med[71]	3.252	1.157	0.005381	1.575	3.069	6.023	10001	100000
	med[72]	3.591	1.24	0.00567	1.779	3.392	6.55	10001	100000
	med[73]	3.957	1.225	0.005094	2.161	3.759	6.877	10001	100000
	med[74]	3.381	1.181	0.005463	1.659	3.195	6.198	10001	100000
	med[75]	2.938	1.124	0.00475	1.348	2.747	5.654	10001	100000
	med[76]	3.192	1.278	0.006465	1.386	2.969	6.286	10001	100000
	med[77]	4.707	2.169	0.009738	1.864	4.276	10.07	10001	100000
	med[78]	1.338	0.6777	0.003581	0.4627	1.198	3.025	10001	100000
	med[79]	1.427	0.6266	0.002466	0.5894	1.308	2.968	10001	100000
	med[80]	1.382	0.6725	0.002574	0.5235	1.245	3.049	10001	100000
	med[81]	1.613	0.7109	0.002941	0.6702	1.477	3.378	10001	100000
	med[82]	1.333	0.6627	0.002494	0.4914	1.197	2.975	10001	100000
	med[83]	3.079	2.207	0.01043	0.8227	2.526	8.67	10001	100000
	med[84]	1.304	0.6011	0.002996	0.501	1.189	2.784	10001	100000
	med[85]	1.485	0.6487	0.002596	0.6183	1.362	3.08	10001	100000
	med[86]	1.384	0.7894	0.00429	0.4166	1.208	3.378	10001	100000
	med[87]	1.541	0.813	0.003373	0.5472	1.365	3.572	10001	100000
	med[88]	1.348	0.5768	0.002386	0.5651	1.242	2.765	10001	100000
	med[89]	1.013	0.5209	0.002282	0.3424	0.9049	2.303	10001	100000
	med[90]	2.397	1.38	0.006263	0.7962	2.08	5.874	10001	100000
	med[91]	12.62	5.782	0.03943	5.216	11.42	26.99	10001	100000
	med[92]	18.41	11.53	0.1128	6.218	15.56	47.76	10001	100000
	med[93]	8.151	3.019	0.02132	3.905	7.614	15.52	10001	100000
	med[94]	11.81	6.189	0.06356	4.64	10.35	27.51	10001	100000
	med[95]	10.63	6.961	0.03674	3.078	8.914	28.48	10001	100000
	med[96]	14.68	10.19	0.06322	4.578	12.12	40.23	10001	100000
	med[97]	6.804	3.762	0.0202	2.253	5.952	16.32	10001	100000
	med[98]	9.334	5.223	0.03035	3.444	8.116	22.47	10001	100000
	med[99]	4.821	2.268	0.01011	1.88	4.362	10.43	10001	100000
	med[100]	6.767	3.579	0.02041	2.563	5.944	15.79	10001	100000
	med[101]	3.131	1.264	0.00641	1.351	2.909	6.2	10001	100000
	med[102]	4.367	1.924	0.01026	1.889	3.971	9.17	10001	100000
	med[103]	1.827	1.188	0.005976	0.4831	1.542	4.848	10001	100000
	med[104]	2.434	1.421	0.006645	0.805	2.105	6.038	10001	100000
	med[105]	1.173	0.6597	0.003683	0.3525	1.028	2.834	10001	100000
	med[106]	1.552	0.728	0.002953	0.6136	1.404	3.351	10001	100000
	rm[1]	10.88	3.799	0.04216	5.764	10.14	20.28	10001	100000
	rm[2]	0.8907	0.4958	0.003769	0.2857	0.7812	2.134	10001	100000
	rm[3]	0.413	0.1764	0.001476	0.1643	0.3824	0.8397	10001	100000
	rm[4]	0.1527	0.08406	6.873E-4	0.04551	0.1351	0.3643	10001	100000
	rm[5]	0.8126	0.1352	5.849E-4	0.5734	0.8038	1.104	10001	100000
	rm[6]	1.157	0.2318	0.001594	0.7861	1.128	1.687	10001	100000
	sigma	1.398	0.1667	0.001384	1.116	1.382	1.767	10001	100000

2.  Weibull Regression in AFT parametrization
    Gives traps.  When it does, just close the trap window and then hit Update two     
    times to get the sampler going again.
      Example 13.1.2

Model

model{ 
 for(i in 1:106){
   sAge[i] <- (age[i]-mean(age[ ]))/sd(age[ ]) 
   sYr[i] <- (Yr[i]-mean(Yr[ ]))/sd(Yr[ ]) 
   t[i] ~ dweib(alpha,lambda[i]) I(c[i] ,)
   lambda[i] <-  log(2)*exp(-mu[i]*sqrt(tau))
   mu[i] <- beta[1] + beta[2]*equals(stage[i],2) + beta[3]*equals(stage[i],3)  + beta[4]*equals(stage[i],4) + beta[5]*sAge[i] + beta[6]*sYr[i]    
 }
 alpha <- sqrt(tau)       
 # 5 month survival probabilities corresponding to predictors in augmented data
 for(i in 91:106) {
   S[i] <- exp(-log(2)*exp(( log(5) - mu[i])*sqrt(tau)))
 # And estimated medians 
   med[i] <- exp(mu[i])  
 }
 for(i in 1:6){
   beta[i] ~ dnorm(0,0.000001)
 # RMs for each variable
   rm[i] <- exp(beta[i])   
   prob[i] <- step(beta[i]) 
 }
 tau ~ dgamma(0.001,0.001)    
 sigma <- sqrt(1/tau)  
}
list(beta=c(0,0,0,0,0,0), tau=1)

DATA AND INITS

list(beta=c(0,0,0,0,0,0), tau=1)

stage[ ] t[ ] age[ ] Yr[ ] c[ ]
1 0.6 77 76 0
1 1.3 53 71 0
1 2.4 45 71 0
1 NA 57 78 2.5
1 3.2 58 74 0
1 NA 51 77 3.2
1 3.3 76 74 0
1 NA 63 77 3.3
1 3.5 43 71 0
1 3.5 60 73 0
1 4 52 71 0
1 4 63 76 0
1 4.3 86 74 0
1 NA 48 76 4.5
1 NA 68 76 4.5
1 5.3 81 72 0
1 NA 70 75 5.5
1 NA 58 75 5.9
1 NA 47 75 5.9
1 6 75 73 0
1 NA 77 75 6.1
1 NA 64 75 6.2
1 6.4 77 72 0
1 6.5 67 70 0
1 NA 79 74 6.5
1 NA 61 74 6.7
1 NA 66 74 7
1 7.4 68 71 0
1 NA 73 73 7.4
1 NA 56 73 8.1
1 NA 73 73 8.1
1 NA 58 71 9.6
1 NA 68 70 10.7
2 0.2 86 74 0
2 1.8 64 77 0
2 2 63 75 0
2 NA 71 78 2.2
2 NA 67 78 2.6
2 NA 51 77 3.3
2 3.6 70 77 0
2 NA 72 77 3.6
2 4 81 71 0
2 NA 47 76 4.3
2 NA 64 76 4.3
2 NA 66 76 5
2 6.2 74 72 0
2 7 62 73 0
2 NA 50 73 7.5
2 NA 53 73 7.6
2 NA 61 71 9.3
3 0.3 49 72 0
3 0.3 71 76 0
3 0.5 57 74 0
3 0.7 79 77 0
3 0.8 82 74 0
3 1 49 76 0
3 1.3 60 76 0
3 1.6 64 72 0
3 1.8 74 71 0
3 1.9 72 74 0
3 1.9 53 74 0
3 3.2 54 75 0
3 3.5 81 74 0
3 NA 52 77 3.7
3 NA 66 76 4.5
3 NA 54 76 4.8
3 NA 63 76 4.8
3 5 59 73 0
3 NA 49 76 5
3 NA 69 76 5.1
3 6.3 70 72 0
3 6.4 65 72 0
3 NA 65 74 6.5
3 7.8 68 72 0
3 NA 78 73 8
3 NA 69 71 9.3
3 NA 51 71 10.1
4 0.1 65 72 0
4 0.3 71 76 0
4 0.4 76 77 0
4 0.8 65 76 0
4 0.8 78 77 0
4 1 41 77 0
4 1.5 68 73 0
4 2 69 76 0
4 2.3 62 71 0
4 NA 74 78 2.9
4 3.6 71 75 0
4 3.8 84 74 0
4 NA 48 76 4.3
1 NA 50 71 0
1 NA 50 77 0
1 NA 70 71 0
1 NA 70 77 0
2 NA 50 71 0
2 NA 50 77 0
2 NA 70 71 0
2 NA 70 77 0
3 NA 50 71 0
3 NA 50 77 0
3 NA 70 71 0
3 NA 70 77 0
4 NA 50 71 0
4 NA 50 77 0
4 NA 70 71 0
4 NA 70 77 0
END

RESULTS

weibull
Dbar = post.mean of -2logL; Dhat = -2LogL at post.mean of stochastic nodes
				Dbar		Dhat		pD			DIC	
t			290.631	283.517	7.114	297.745	
total	290.631	283.517	7.114	297.745

 node	 mean	 sd	 MC error	2.5%	median	97.5%	start	sample
	S[91]	0.714	0.09455	7.517E-4	0.5064	0.7236	0.8702	10001	99988
	S[92]	0.7574	0.09055	9.567E-4	0.5505	0.7687	0.9005	10001	99988
	S[93]	0.6156	0.08993	7.521E-4	0.4295	0.6196	0.7787	10001	99988
	S[94]	0.6692	0.1008	0.001127	0.4492	0.6779	0.8392	10001	99988
	S[95]	0.6748	0.1245	8.783E-4	0.3981	0.6881	0.8782	10001	99988
	S[96]	0.7253	0.1078	8.015E-4	0.4833	0.7378	0.898	10001	99988
	S[97]	0.5677	0.1355	9.923E-4	0.2893	0.5744	0.8115	10001	99988
	S[98]	0.6276	0.1279	9.748E-4	0.3553	0.6377	0.8464	10001	99988
	S[99]	0.53	0.1232	7.91E-4	0.2791	0.5354	0.754	10001	99988
	S[100]	0.5929	0.1226	8.912E-4	0.332	0.6013	0.8062	10001	99988
	S[101]	0.3984	0.1067	6.757E-4	0.1986	0.3961	0.6108	10001	99988
	S[102]	0.4692	0.1259	9.215E-4	0.2184	0.4716	0.7056	10001	99988
	S[103]	0.2011	0.1474	9.67E-4	0.009358	0.1711	0.5476	10001	99988
	S[104]	0.2559	0.1421	9.69E-4	0.0377	0.2383	0.571	10001	99988
	S[105]	0.09975	0.0902	5.677E-4	0.003258	0.07366	0.336	10001	99988
	S[106]	0.1395	0.09389	6.041E-4	0.01666	0.1196	0.3696	10001	99988
	alpha	1.012	0.1355	0.001394	0.7604	1.006	1.293	10001	99988
	beta[1]	2.224	0.2929	0.003715	1.709	2.204	2.86	10001	99988
	beta[2]	-0.136	0.4855	0.004912	-1.065	-0.1486	0.8597	10001	99988
	beta[3]	-0.6637	0.3794	0.003954	-1.45	-0.6525	0.0531	10001	99988
	beta[4]	-1.695	0.4593	0.00484	-2.644	-1.68	-0.8335	10001	99988
	beta[5]	-0.2136	0.1604	0.001064	-0.5421	-0.2089	0.08867	10001	99988
	beta[6]	0.08613	0.1758	0.00154	-0.2437	0.07996	0.4522	10001	99988
	med[91]	11.82	5.512	0.05042	5.093	10.61	25.62	10001	99988
	med[92]	15.26	8.89	0.1028	5.775	13.06	37.87	10001	99988
	med[93]	7.658	2.573	0.02312	4.059	7.207	13.9	10001	99988
	med[94]	9.931	4.725	0.05583	4.348	8.874	21.71	10001	99988
	med[95]	10.82	6.686	0.05121	3.729	9.193	27.52	10001	99988
	med[96]	13.69	9.88	0.08776	4.77	11.32	36.46	10001	99988
	med[97]	7.104	3.851	0.02877	2.73	6.238	16.68	10001	99988
	med[98]	9.014	5.569	0.04684	3.38	7.668	22.72	10001	99988
	med[99]	6.014	2.504	0.01528	2.631	5.539	12.24	10001	99988
	med[100]	7.657	3.797	0.03013	3.172	6.789	17.28	10001	99988
	med[101]	3.943	1.282	0.008121	2.001	3.755	6.968	10001	99988
	med[102]	5.039	2.097	0.01513	2.3	4.614	10.3	10001	99988
	med[103]	2.3	1.381	0.009257	0.6931	1.982	5.754	10001	99988
	med[104]	2.744	1.379	0.008369	1.091	2.433	6.259	10001	99988
	med[105]	1.48	0.6984	0.005166	0.538	1.349	3.197	10001	99988
	med[106]	1.776	0.666	0.003415	0.8655	1.651	3.416	10001	99988
	prob[1]	1.0	0.0	3.162E-13	1.0	1.0	1.0	10001	99988
	prob[2]	0.3764	0.4845	0.004091	0.0	0.0	1.0	10001	99988
	prob[3]	0.03405	0.1814	0.00101	0.0	0.0	1.0	10001	99988
	prob[4]	1.5E-4	0.01225	4.282E-5	0.0	0.0	0.0	10001	99988
	prob[5]	0.08596	0.2803	0.00129	0.0	0.0	1.0	10001	99988
	prob[6]	0.6832	0.4652	0.003331	0.0	1.0	1.0	10001	99988
	rm[1]	9.673	3.151	0.04006	5.522	9.058	17.46	10001	99988
	rm[2]	0.9861	0.5501	0.005237	0.3448	0.8619	2.362	10001	99988
	rm[3]	0.5525	0.2114	0.00207	0.2346	0.5207	1.055	10001	99988
	rm[4]	0.2035	0.0952	9.266E-4	0.07108	0.1863	0.4345	10001	99988
	rm[5]	0.818	0.1303	8.442E-4	0.5815	0.8115	1.093	10001	99988
	rm[6]	1.107	0.2006	0.001763	0.7837	1.083	1.572	10001	99988
	sigma	1.007	0.1379	0.00143	0.7733	0.9937	1.315	10001	99988
	tau	1.042	0.2799	0.002844	0.5782	1.013	1.672	10001	99988

3.  Exponential Regression in AFT parametrization
    Gives traps.  When it does, just close the trap window and then hit Update two 
    times to get the sampler going again.
        Exercise 13.1

4.  Log Logistic 
     Example 13.1.3 and Exercise 13.2

Model

model{ 
 for(i in 1:106){
   sAge[i] <- (age[i]-mean(age[ ]))/sd(age[ ]) 
   sYr[i] <- (Yr[i]-mean(Yr[ ]))/sd(Yr[ ]) 
   logt[i] ~ dlogis(mu[i], taustar)I(logc[i],)
   mu[i] <- beta[1] + beta[2]*equals(stage[i],2) + beta[3]*equals(stage[i],3)  + beta[4]*equals(stage[i],4) + beta[5]*sAge[i] + beta[6]*sYr[i] 
 }
 taustar <- sqrt(tau)
#  5 month survival probabilities corresponding to predictors in augmented data
 for (i in 91:106) {
   S[i] <-   1/(1+ exp(( log(5) - mu[i])*sqrt(tau)))
# Estimated medians corresponding to the covariates in the data
 med[i] <- exp(mu[i])
 }
 for(i in 1:6){
   beta[i] ~ dnorm(0,0.000001)
#  RMs for each variable
  rm[i] <- exp(beta[i])  
  prob[i] <- step(beta[i])
 }
tau ~ dgamma(0.001,0.001)    
sigma <- sqrt(1/tau)
junk1 <- t[1]
junk2 <- c[1]
}