Below are the solutions to these exercises on “Bayesian Inference – MCMC Diagnostics using coda : Exercises”. #### Run the folowing lines before doing the exercises # ================================================================ ## Vector of packages to use in this report pkgs <- c(‘evd’, "coda", "reshape2", "tidyverse") ## Install packages From CRAN if they are not installed. for (p […]
Bayesian Inference – MCMC Diagnostics using coda : Exercises
This post presents the main convergence diagnostics of Markov chains for Bayesian inference. We have seen a first introduction of Bayesian inference with Markov Chain Monte Carlo (MCMC) techniques in previous posts (here and here). Exercises related to the two main MCMC algorithms used to do Bayesian inference have been presented : Gibbs sampler and […]
MCMC for Bayesian Inference – Gibbs Sampling: Solutions
Below are the solutions to these exercises on “MCMC for Bayesian Inference – Gibbs Sampling: Exercises”. #### Run the folowing lines before doing the exercises # ================================================================ ## Vector of packages to use in this report pkgs <- c(‘evd’, “ggplot2”, “gridExtra”) ## Install packages From CRAN if they are not installed. for (p in pkgs) […]
MCMC For Bayesian Inference – Gibbs Sampling: Exercises
In the last post, we saw that the Metropolis sampler can be used in order to generate a random sample from a posterior distribution that cannot be found analytically. Following the same idea, Gibbs sampling is a popular Markov Chain Monte Carlo (MCMC) technique that is more efficient, in general, since the updates of the […]
MCMC for Bayesian Inference – Metropolis: Exercises
Previously, we introduced Bayesian Inference with R using the Markov Chain Monte Carlo (MCMC) techniques. The first set of exercises gave insights on the Bayesian paradigm, while the second set focused on well-known sampling techniques that can be used to generate a sample from the posterior distribution . While the next set of exercises will […]
MCMC for Bayesian Inference – Metropolis: Solutions
Below are the solutions to these exercises on “MCMC for Bayesian Inference – Metropolis: Exercises.” #### Run the folowing lines before doing the exercises: # ================================================================ ## Vector of packages to use in this report pkgs <- c(‘evd’) ## Install packages From CRAN if they are not installed. for(p in pkgs) { if (p %in% […]
Basic Bayesian Inference for MCMC Techniques: Exercises (Part 2)
In the first part , we saw a small introduction of the Bayesian inference and a first approach of Monte-Carlo techniques. Now, we will get through the Monte Carlo in order to obtain a random sample from the posterior distribution using some common techniques. Then, the next post will present the well-known Metropolis(-Hastings), Gibbs sampler, […]
Basic Bayesian Inference for MCMC techniques : Solutions (Part 2)
Below are the solutions to these exercises on “Bayesian Inference : introduction for MCMC techniques (part 1)”. #### Run the folowing lines before doing the exercises # ================================================================ ## Vector of packages to use in this report pkgs <- c(‘microbenchmark’) ## Install packages From CRAN if they are not installed. for(p in pkgs) { if […]
Basic Bayesian Inference for MCMC techniques : Solutions (Part 1)
Below are the solutions to these exercises on “Bayesian Inference : introduction for MCMC techniques (part 1)”. ############### # # # Exercise 1 # # # ############### # a. Binomial distribution with n = 1000 and probability of ‘success’ = 735/1000 plot(dbinom(x = seq(1, 100, 1), size = 100, prob = 735/1000), type = "l", […]
Basic Bayesian Inference for MCMC techniques : Exercises (Part 1)
This post aims to introduce you to the basics of Bayesian inference. The ultimate goal of this introductory set of exercises is to get you ready for Bayesian inference using Markov Chain Monte Carlo (MCMC). Little reminder The whole Bayesian paradigm is based on the Bayesian Theorem that we all know (right ?), generally formulated […]








