library(LearnBayes)
library(BayesianTools)
ll <- generateTestDensityMultiNormal(sigma = "no correlation")
bayesianSetup = createBayesianSetup(likelihood = ll, lower = rep(-10, 3), upper = rep(10, 3))
iter = 10000
settings = list(iterations = iter, message = FALSE)
out <- runMCMC(bayesianSetup = bayesianSetup, sampler = "Metropolis", settings = settings)
summary(out)
## # # # # # # # # # # # # # # # # # # # # # # # # # 
## ## MCMC chain summary ## 
## # # # # # # # # # # # # # # # # # # # # # # # # # 
##  
## # MCMC sampler:  Metropolis 
## # Nr. Chains:  1 
## # Iterations per chain:  10000 
## # Rejection rate:  0.692 
## # Effective sample size:  880 
## # Runtime:  14.01  sec. 
##  
## # Parameters
##         MAP   2.5% median 97.5%
## par 1 0.001 -1.973 -0.006 2.001
## par 2 0.000 -1.885 -0.011 1.951
## par 3 0.000 -2.088 -0.066 2.002
## 
## ## DIC:  11.77 
## ## Convergence 
##  Gelman Rubin multivariate psrf:  Only one chain; convergence cannot be determined! 
##  
## ## Correlations 
##       par 1  par 2 par 3
## par 1 1.000  0.028  0.02
## par 2 0.028  1.000 -0.02
## par 3 0.020 -0.020  1.00
plot(out)

correlationPlot(out)

marginalPlot(out)

marginalLikelihood(out)
## $ln.ML
## [1] -8.95998
## 
## $ln.lik.star
## [1] -2.756816
## 
## $ln.pi.star
## [1] -8.987197
## 
## $ln.pi.hat
## [1] -2.784033
## 
## $method
## [1] "Chib"