I do not understander how "thin" setting affects the number of samples in WinBUGS. Here is my case:
Case 1: In Model --> Update... -> Update Tool, I set updates 5000, refresh 100, thin 1, click update. In Inference -> Samples...-> sample is 4500 in stats
Case 2: In Model --> Update... -> Update Tool, I set updates 5000, refresh 100, thin 2, click update. In Inference -> Samples...-> sample is 4750 in stats
Case 3: In Model --> Update... -> Update Tool, I set updates 5000, refresh 100, thin 5, click update. In Inference -> Samples...-> sample is 4900 in stats
Case 4: In Model --> Update... -> Update Tool, I set updates 5000, refresh 100, thin 10, click update. In Inference -> Samples...-> sample is 4950 in stats
Based on WinBUGS User Manual, thin is the samples from every kth iteration will be stored, where k is the value of thin. Setting k > 1 can help to reduce the autocorrelation in the sample, but there is no real advantage in thinning except to reduce storage requirements and the cost of handling the simulations when very long runs are being carried out.
My questions are
In Case 1, why sample is 4500 not 5000?
How does the "thin" setting affect the sample size in Node Statistics?
The following is my code.
model {
for(i in 1: N) {
CF01 ~ dnorm(0, 20)
CF02 ~ dnorm(0, 1)
h ~ dpois (lambda )
log(lambda ) <- beta0 + beta1*CF03 + beta2*CF02 + beta3*CF01 + beta4*IND
}
beta0 ~ dnorm(0.0, 1.0E-6)
beta1 ~ dnorm(0.0, 1.0E-6)
beta2 ~ dnorm(0.0, 1.0E-6)
beta3 ~ dnorm(0.0, 1.0E-6)
beta4 <- log(p)
p ~ dunif(lower, upper)
}
INITS
list(beta0 = 0, beta1 = 0, beta2 = 0, beta3 = 0, p = 0.9)
DATA(LIST)
list(N = 15, lower = 0.80, upper = 0.95,
h = c(1,4,1,2,1,2,1,1,1,3,3,0,0,0,NA),
CF03 = c(-1.5,0.1,1.0,0.1,-0.7,0.6,0.2,
0.1,-0.3,1.9,-1.5,0.2,1.0,-0.3,0.8),
CF02 = c(NA,NA,0.3,0.1,-0.9,-0.1,-0.2,-0.7,
-0.9,2.3,1.4,1.2,1.2,-0.7,-1.5),
CF01 = c(NA,NA,NA,-0.1,-0.2,-0.3,-0.2,-0.2,-0.2,
-0.1,0.1,-0.2,-0.2,-0.1,0.1),
IND = c(1,1,0,0,0,0,0,0,0,0,0,0,0,0,0))