Bayesian interval of 5 fitted values

2019-07-19 02:30发布

I conducted a Bayesian analysis by running Winbugs from R and derived the fitted values and their Bayesian intervals. Here is the related Winbugs output where mu[i] is the i-th fitted value.

node     mean   2.5%    97.5%   
mu[1]   0.7699  0.6661  0.94    
mu[2]   0.8293  0.4727  1.022   
mu[3]   0.7768  0.4252  0.9707  
mu[4]   0.6369  0.4199  0.8254  
mu[5]   0.7704  0.5054  1.023   

What I want to do is to find the Bayesian interval for the mean of these 5 fitted values. Any idea how?

2条回答
Root(大扎)
2楼-- · 2019-07-19 03:14

Define another node in the WinBUGS model code

mu.mean <- mean(mu[])

and monitor it?

查看更多
够拽才男人
3楼-- · 2019-07-19 03:19

The answer of Chris Jackson is correct, however, if your model has been running for hours, you will not be happy, because it means modifying the model and running it again. But you can achieve your goal in R in the post-process without running the model again - by taking mean of the posterior samples:

out <- bugs(...)
sapply(out$sims.list$mu, mean, ...) # I'm not sure exactly about the structure of
                                    # out$sims.list$mu, so it might be slightly 
                                    # different
查看更多
登录 后发表回答