I have set up a winbugs program, and setting a number of nodes to sample. When I go to look at particular nodes (by name or with * in the inference/samples box) some of them don't come up in the trace, (or in density or stats).

Has anyone else had this problem, or can tell me what I am doing wrong. Below is the model code I use. The nodes that won't trace are beta0, beta1,beta2, alpha0, alpha1, alpha2.

thanks all.

Emma

model{

# Likelihood,

for (j in 1:1){

for (i in 1 : N) {

ObKebT[i, j]~ dpois(expectation[i, j]);

expectation[i, j]<-p[i, j]*absolute[i, j];

logitinc[i, j] <- beta0 +beta1*X

*+ u[i, j] + ss[j, i];*

inc[i, j]<-exp(logitinc[i, j])/(1+exp(logitinc[i,j]));

absolute[i, j]<-inc[i, j]*PopT[i, j];

logp[i, j]<-alpha0 +alpha1*Xhc

inc[i, j]<-exp(logitinc[i, j])/(1+exp(logitinc[i,j]));

absolute[i, j]<-inc[i, j]*PopT[i, j];

logp[i, j]<-alpha0 +alpha1*Xhc

*;*

p[i, j]<-exp(logp[i, j])/(1+exp(logp[i,j]));

u[i, j] ~ dnorm(0, tau.u);

missing[i, j]<-absolute[i, j]-ObKebT[i, j];

}

ss[ j, 1:N] ~ car.normal (adj[], weights[1:sumNumNeigh, j], num[], tau.s);

for (k in 1:sumNumNeigh){

weights[k, j] <- 1;

}

}

for (j in 2:5){

for (i in 1 : N) {

ObKebT[i, j]~ dpois(expectation[i, j]);

expectation[i, j]<-p[i, j]*absolute[i, j];

logitinc[i, j] <- beta0 +beta1*Xp[i, j]<-exp(logp[i, j])/(1+exp(logp[i,j]));

u[i, j] ~ dnorm(0, tau.u);

missing[i, j]<-absolute[i, j]-ObKebT[i, j];

}

ss[ j, 1:N] ~ car.normal (adj[], weights[1:sumNumNeigh, j], num[], tau.s);

for (k in 1:sumNumNeigh){

weights[k, j] <- 1;

}

}

for (j in 2:5){

for (i in 1 : N) {

ObKebT[i, j]~ dpois(expectation[i, j]);

expectation[i, j]<-p[i, j]*absolute[i, j];

logitinc[i, j] <- beta0 +beta1*X

*+ u[i, j] + ss[j, i]; # +beta2*lag1[i, j]*

inc[i, j]<-exp(logitinc[i, j])/(1+exp(logitinc[i,j]));

absolute[i, j]<-inc[i, j]*PopT[i,j];

logp[i, j]<-alpha0 +alpha1*Xhcinc[i, j]<-exp(logitinc[i, j])/(1+exp(logitinc[i,j]));

absolute[i, j]<-inc[i, j]*PopT[i,j];

logp[i, j]<-alpha0 +alpha1*Xhc

*;*

p[i, j]<-exp(logp[i, j])/(1+exp(logp[i,j]));

# lag1[i, j]<-inc[i, j-1]*PopT[i, j];

u[i, j] ~ dnorm(0, tau.u);

#beta2lag[i, j]<-beta2*lag1[i, j];

missingprop[i, j]<-ObKebT[i, j]/absolute[i, j];

}

ss[j, 1:N] ~ car.normal (adj[], weights[1:sumNumNeigh, j], num[], tau.s);

for (k in 1:sumNumNeigh){

weights[k, j] <- 1

}

}

# priors

tau.u ~ dgamma(0.01, 0.01); # tau.u is unknown and vague gamma distribution specified

tau.s ~ dgamma(0.5, 0.0005); # precision(inverse of variance)

beta0 ~ dnorm(0, 0.00001);

beta1 ~ dnorm(0, 0.00001);

beta2 ~ dnorm(0, 0.00001);

alpha0~dnorm(0, 0.01);

alpha1~dnorm(0, 0.01);

# functions

p.beta1 <- step(beta1); # records whether beta1 is positive

sigma.u <- sqrt(1/tau.u)

sigma.s <- sqrt(1/tau.s) # sd of precision

}

# Data

#num specifies the number of columns in the following matrix

list( N= 66,

X = c(16, 16, 10, 24, 10, 24, 10, 7, 7, 16, 7, 16, 10, 24, 7, 16,

10, 7, 7, 10, 7, 16, 10, 7, 1, 1, 7, 7, 10, 10, 7, 24, 10, 7, 7,

0, 10, 1, 16, 0, 1, 16, 16, 0, 1, 7, 1, 1, 0, 1, 1, 0, 1, 1, 16,

10, 10, 1, 16, 0, 1, 16, 16, 0, 1, 7), # dummy covariate

num = c(3, 5, 7, 2, 3, 10, 3, 4, 6, 5,

5, 9, 5, 4, 5, 8, 3, 5, 6, 4,

4, 3, 3, 3, 4, 4, 4, 7, 9, 5,

4, 2, 3, 7, 7, 3, 6, 2, 8, 4,

2, 5, 5, 4, 6, 3, 6, 7, 5, 5,

3, 3, 5, 2, 4, 5, 5, 5, 4, 3,

3, 1, 7, 5, 5, 2),

adj = c(13, 12, 6,

35, 34, 30, 29, 28,

65, 56, 55, 53, 50, 49, 48,

6, 5,

23, 6, 4,

23, 15, 14, 13, 12, 11, 7, 5, 4, 1,

11, 8, 6,

11, 10, 9, 7,

29, 28, 25, 24, 10, 8,

29, 12, 11, 9, 8,

12, 10, 8, 7, 6,

29, 18, 17, 16, 13, 11, 10, 6, 1,

16, 14, 12, 6, 1,

16, 15, 13, 6,

23, 20, 16, 14, 6,

20, 19, 18, 17, 15, 14, 13, 12,

18, 16, 12,

29, 19, 17, 16, 12,

39, 29, 21, 20, 18, 16,

21, 19, 16, 15,

39, 22, 20, 19,

39, 32, 21,

15, 6, 5,

26, 25, 9,

28, 26, 24, 9,

28, 27, 25, 24,

40, 35, 28, 26,

35, 29, 27, 26, 25, 9, 2,

39, 30, 28, 19, 18, 12, 10, 9, 2,

39, 34, 31, 29, 2,

39, 34, 33, 30,

39, 22,

39, 34, 31,

37, 36, 35, 33, 31, 30, 2,

40, 37, 36, 34, 28, 27, 2,

37, 35, 34,

63, 40, 38, 36, 35, 34,

40, 37,

33, 32, 31, 30, 29, 22, 21, 19,

38, 37, 35, 27,

63, 42,

63, 50, 49, 43, 41,

63, 49, 48, 44, 42,

63, 48, 45, 43,

64, 63, 48, 47, 46, 44,

63, 47, 45,

64, 59, 58, 57, 46, 45,

64, 56, 49, 45, 44, 43, 3,

50, 48, 43, 42, 3,

53, 51, 49, 42, 3,

53, 52, 50,

65, 53, 51,

65, 52, 51, 50, 3,

65, 55,

65, 56, 54, 3,

64, 57, 55, 48, 3,

66, 64, 58, 56, 47,

66, 60, 59, 57, 47,

61, 60, 58, 47,

61, 59, 58,

62, 60, 59,

61,

46, 45, 44, 43, 42, 41, 37,

57, 56, 48, 47, 45,

55, 54, 53, 52, 3,

58, 57),

sumNumNeigh = 304,

ObKebT = structure(

.Data = c(29,37,23,22,17,0,4,7,14,20,108,153,134,175,142,2,3,0,0,2,1,2,2,1,1,4,3,3,2,2,8,2,0,4,2,1,0,0,0,1,0,1,0,0,0,1,4,2,0,0,1,2,2,0,1,2,2,0,0,2,2,3,2,1,1,0,1,0,0,0,0,0,1,2,1,1,0,0,1,1,3,2,2,3,3,0,1,1,2,2,1,0,0,9,3,0,0,0,0,0,0,2,0,2,3,0,0,0,3,0,0,0,0,0,0,0,1,0,0,0,2,7,2,0,0,1,0,0,1,2,0,0,0,0,0,0,0,1,0,3,0,0,2,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,0,0,3,0,1,0,0,7,0,1,1,0,0,0,1,0,2,0,1,8,6,5,7,0,0,0,0,0,0,0,0,0,0,0,0,3,23,14,1,0,0,33,27,0,0,0,7,3,1,2,0,3,0,4,1,0,0,1,0,0,0,0,2,1,0,2,1,8,7,3,5,4,7,6,2,1,4,6,18,12,18,19,20,0,2,5,10,8,1,5,9,4,10,5,12,10,12,8,0,0,0,0,1,4,2,0,4,9,12,8,10,19,10,3,2,4,1,0,2,10,7,3,4,4,25,38,2,10,0,3,7,0,2,2,3,8,3,2,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,4,3,0,0,0,0,0,0),

.Dim = c( 66, 5) ),

PopT= structure(

.Data = c(7812,8187,8580,8992,9423,3005,3150,3301,3474,3625,28579,29951,

31388,32895,34474,1257,1292,1328,1366,1404,2539,2610,2683,2759,2836,3730,3834,3941,4050,4163,3960,4071,4185,4303,4424,1121,

1153,1185,1218,1253,1324,1361,1399,1439,1479,2066,2124,2184,

2246,2308,1948,2002,2058,2114,2174,2251,2314,2379,2446,2515,

1730,1778,1828,1880,1932,882,907,932,959,986,661,679,698,715,

735,2125,2184,2246,2309,2374,1759,1808,1859,1911,1965,2217,2279,2343,2410,2477,2901,2982,3065,3149,3237,1231,1265,1301,1338,

1375,1659,1705,1753,1800,1851,1082,1112,1143,1176,1209,520,535,550,566,581,2293,2358,2424,2489,2560,1697,1744,1793,1844,1896,

1266,1301,1337,1375,1414,633,651,669,688,708,1343,1380,1419,

1456,1498,993,1021,1049,1079,1110,760,782,804,826,850,1118,1149,1181,1214,1249,1454,1494,1536,1579,1624,1736,1785,1835,1885,

1939,1759,1808,1859,1908,1963,1420,1460,1501,1540,1584,1007,

1035,1064,1092,1123,1773,1823,1874,1925,1980,2535,2605,2678,

2752,2831,100,100,100,100,100,1434,1474,1515,1558,1602,7156,7356,7562,

7775,7993,7791,8010,8234,8464,8701,4734,4867,5003,5145,5289,

5450,5603,5760,5921,6087,7541,7752,7969,8190,8420,3019,3104,

3190,3281,3373,9279,9539,9806,10076,10358,6441,6621,6807,6999,

7195,4247,4366,4816,4615,4744,4557,4685,4816,4952,5091,3212,

3302,3395,3490,3587,3608,3709,3813,3913,4023,3028,3113,3200,

3290,3382,3961,4072,4186,4303,4423,3601,3702,3806,3913,4023,

4554,4682,4813,4949,5087,3941,4052,4165,4283,4403,2410,2477,

2546,2615,2688,11050,11359,11677,12005,12341,4676,4807,4941,

5079,5221,5950,6117,6288,6466,6647,4200,4318,4438,4564,4692,803,825,848,871,896,539,554,569,586,602,2939,3021,3106,3193,3283,478,491,505,519,534),

.Dim = c(66, 5) ),

Xhc=c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

# initial values

list(beta0 = 0, beta1 = 0, alpha1=0, alpha0=1,beta2=0, tau.u = 1, tau.s = 1)

# no covariate effect since flat slope(beta1=0)p[i, j]<-exp(logp[i, j])/(1+exp(logp[i,j]));

# lag1[i, j]<-inc[i, j-1]*PopT[i, j];

u[i, j] ~ dnorm(0, tau.u);

#beta2lag[i, j]<-beta2*lag1[i, j];

missingprop[i, j]<-ObKebT[i, j]/absolute[i, j];

}

ss[j, 1:N] ~ car.normal (adj[], weights[1:sumNumNeigh, j], num[], tau.s);

for (k in 1:sumNumNeigh){

weights[k, j] <- 1

}

}

# priors

tau.u ~ dgamma(0.01, 0.01); # tau.u is unknown and vague gamma distribution specified

tau.s ~ dgamma(0.5, 0.0005); # precision(inverse of variance)

beta0 ~ dnorm(0, 0.00001);

beta1 ~ dnorm(0, 0.00001);

beta2 ~ dnorm(0, 0.00001);

alpha0~dnorm(0, 0.01);

alpha1~dnorm(0, 0.01);

# functions

p.beta1 <- step(beta1); # records whether beta1 is positive

sigma.u <- sqrt(1/tau.u)

sigma.s <- sqrt(1/tau.s) # sd of precision

}

# Data

#num specifies the number of columns in the following matrix

list( N= 66,

X = c(16, 16, 10, 24, 10, 24, 10, 7, 7, 16, 7, 16, 10, 24, 7, 16,

10, 7, 7, 10, 7, 16, 10, 7, 1, 1, 7, 7, 10, 10, 7, 24, 10, 7, 7,

0, 10, 1, 16, 0, 1, 16, 16, 0, 1, 7, 1, 1, 0, 1, 1, 0, 1, 1, 16,

10, 10, 1, 16, 0, 1, 16, 16, 0, 1, 7), # dummy covariate

num = c(3, 5, 7, 2, 3, 10, 3, 4, 6, 5,

5, 9, 5, 4, 5, 8, 3, 5, 6, 4,

4, 3, 3, 3, 4, 4, 4, 7, 9, 5,

4, 2, 3, 7, 7, 3, 6, 2, 8, 4,

2, 5, 5, 4, 6, 3, 6, 7, 5, 5,

3, 3, 5, 2, 4, 5, 5, 5, 4, 3,

3, 1, 7, 5, 5, 2),

adj = c(13, 12, 6,

35, 34, 30, 29, 28,

65, 56, 55, 53, 50, 49, 48,

6, 5,

23, 6, 4,

23, 15, 14, 13, 12, 11, 7, 5, 4, 1,

11, 8, 6,

11, 10, 9, 7,

29, 28, 25, 24, 10, 8,

29, 12, 11, 9, 8,

12, 10, 8, 7, 6,

29, 18, 17, 16, 13, 11, 10, 6, 1,

16, 14, 12, 6, 1,

16, 15, 13, 6,

23, 20, 16, 14, 6,

20, 19, 18, 17, 15, 14, 13, 12,

18, 16, 12,

29, 19, 17, 16, 12,

39, 29, 21, 20, 18, 16,

21, 19, 16, 15,

39, 22, 20, 19,

39, 32, 21,

15, 6, 5,

26, 25, 9,

28, 26, 24, 9,

28, 27, 25, 24,

40, 35, 28, 26,

35, 29, 27, 26, 25, 9, 2,

39, 30, 28, 19, 18, 12, 10, 9, 2,

39, 34, 31, 29, 2,

39, 34, 33, 30,

39, 22,

39, 34, 31,

37, 36, 35, 33, 31, 30, 2,

40, 37, 36, 34, 28, 27, 2,

37, 35, 34,

63, 40, 38, 36, 35, 34,

40, 37,

33, 32, 31, 30, 29, 22, 21, 19,

38, 37, 35, 27,

63, 42,

63, 50, 49, 43, 41,

63, 49, 48, 44, 42,

63, 48, 45, 43,

64, 63, 48, 47, 46, 44,

63, 47, 45,

64, 59, 58, 57, 46, 45,

64, 56, 49, 45, 44, 43, 3,

50, 48, 43, 42, 3,

53, 51, 49, 42, 3,

53, 52, 50,

65, 53, 51,

65, 52, 51, 50, 3,

65, 55,

65, 56, 54, 3,

64, 57, 55, 48, 3,

66, 64, 58, 56, 47,

66, 60, 59, 57, 47,

61, 60, 58, 47,

61, 59, 58,

62, 60, 59,

61,

46, 45, 44, 43, 42, 41, 37,

57, 56, 48, 47, 45,

55, 54, 53, 52, 3,

58, 57),

sumNumNeigh = 304,

ObKebT = structure(

.Data = c(29,37,23,22,17,0,4,7,14,20,108,153,134,175,142,2,3,0,0,2,1,2,2,1,1,4,3,3,2,2,8,2,0,4,2,1,0,0,0,1,0,1,0,0,0,1,4,2,0,0,1,2,2,0,1,2,2,0,0,2,2,3,2,1,1,0,1,0,0,0,0,0,1,2,1,1,0,0,1,1,3,2,2,3,3,0,1,1,2,2,1,0,0,9,3,0,0,0,0,0,0,2,0,2,3,0,0,0,3,0,0,0,0,0,0,0,1,0,0,0,2,7,2,0,0,1,0,0,1,2,0,0,0,0,0,0,0,1,0,3,0,0,2,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,0,0,3,0,1,0,0,7,0,1,1,0,0,0,1,0,2,0,1,8,6,5,7,0,0,0,0,0,0,0,0,0,0,0,0,3,23,14,1,0,0,33,27,0,0,0,7,3,1,2,0,3,0,4,1,0,0,1,0,0,0,0,2,1,0,2,1,8,7,3,5,4,7,6,2,1,4,6,18,12,18,19,20,0,2,5,10,8,1,5,9,4,10,5,12,10,12,8,0,0,0,0,1,4,2,0,4,9,12,8,10,19,10,3,2,4,1,0,2,10,7,3,4,4,25,38,2,10,0,3,7,0,2,2,3,8,3,2,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,4,3,0,0,0,0,0,0),

.Dim = c( 66, 5) ),

PopT= structure(

.Data = c(7812,8187,8580,8992,9423,3005,3150,3301,3474,3625,28579,29951,

31388,32895,34474,1257,1292,1328,1366,1404,2539,2610,2683,2759,2836,3730,3834,3941,4050,4163,3960,4071,4185,4303,4424,1121,

1153,1185,1218,1253,1324,1361,1399,1439,1479,2066,2124,2184,

2246,2308,1948,2002,2058,2114,2174,2251,2314,2379,2446,2515,

1730,1778,1828,1880,1932,882,907,932,959,986,661,679,698,715,

735,2125,2184,2246,2309,2374,1759,1808,1859,1911,1965,2217,2279,2343,2410,2477,2901,2982,3065,3149,3237,1231,1265,1301,1338,

1375,1659,1705,1753,1800,1851,1082,1112,1143,1176,1209,520,535,550,566,581,2293,2358,2424,2489,2560,1697,1744,1793,1844,1896,

1266,1301,1337,1375,1414,633,651,669,688,708,1343,1380,1419,

1456,1498,993,1021,1049,1079,1110,760,782,804,826,850,1118,1149,1181,1214,1249,1454,1494,1536,1579,1624,1736,1785,1835,1885,

1939,1759,1808,1859,1908,1963,1420,1460,1501,1540,1584,1007,

1035,1064,1092,1123,1773,1823,1874,1925,1980,2535,2605,2678,

2752,2831,100,100,100,100,100,1434,1474,1515,1558,1602,7156,7356,7562,

7775,7993,7791,8010,8234,8464,8701,4734,4867,5003,5145,5289,

5450,5603,5760,5921,6087,7541,7752,7969,8190,8420,3019,3104,

3190,3281,3373,9279,9539,9806,10076,10358,6441,6621,6807,6999,

7195,4247,4366,4816,4615,4744,4557,4685,4816,4952,5091,3212,

3302,3395,3490,3587,3608,3709,3813,3913,4023,3028,3113,3200,

3290,3382,3961,4072,4186,4303,4423,3601,3702,3806,3913,4023,

4554,4682,4813,4949,5087,3941,4052,4165,4283,4403,2410,2477,

2546,2615,2688,11050,11359,11677,12005,12341,4676,4807,4941,

5079,5221,5950,6117,6288,6466,6647,4200,4318,4438,4564,4692,803,825,848,871,896,539,554,569,586,602,2939,3021,3106,3193,3283,478,491,505,519,534),

.Dim = c(66, 5) ),

Xhc=c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

# initial values

list(beta0 = 0, beta1 = 0, alpha1=0, alpha0=1,beta2=0, tau.u = 1, tau.s = 1)

# no covariate effect since flat slope(beta1=0)