Question

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?

Was it helpful?

Solution

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

OTHER TIPS

Define another node in the WinBUGS model code

mu.mean <- mean(mu[])

and monitor it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top