全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 winbugs及其他软件专版
1388 1
2014-06-16
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))
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-6-16 02:04:28
Let N be the number of updates, T be the 1 / the thin rate (e.g., 10 = return 1 out of every 10 samples), B be the number of burnin samples, and S be the number of returned samples.

The number of burnin samples defaults to 0.1N. The total number of samples is the number of updates divided by the thin rate, NT. We then subtract off the burnin samples to get the number of (unthinned) samples NT−B, and multiply by the thin rate to get the number of samples actually returned.

Thus B=0.1N and S=(NT−B)/T.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群