Skip to main content

Questions tagged [markov-chain-montecarlo]

Markov Chain Monte Carlo (MCMC) refers to a class of simulation methods for generating samples from a complex target distribution by generating random numbers from a Markov Chain whose stationary distribution is the target distribution. MCMC methods are typically used when more direct methods for random number generation (e.g. inversion method) are infeasible. The very first MCMC method was the Metropolis (et al.) algorithm, later expanded by Hastings.

Filter by
Sorted by
Tagged with
277 votes
12 answers
188k views

How would you explain Markov Chain Monte Carlo (MCMC) to a layperson?

Maybe the concept, why it's used, and an example.
Neil McGuigan's user avatar
53 votes
1 answer
17k views

Variational inference versus MCMC: when to choose one over the other?

I think I get the general idea of both VI and MCMC including the various flavors of MCMC like Gibbs sampling, Metropolis Hastings etc. This paper provides a wonderful exposition of both methods. I ...
kedarps's user avatar
  • 3,572
51 votes
1 answer
24k views

What is the difference between Metropolis-Hastings, Gibbs, Importance, and Rejection sampling?

I have been trying to learn MCMC methods and have come across Metropolis-Hastings, Gibbs, Importance, and Rejection sampling. While some of these differences are obvious, i.e., how Gibbs is a special ...
user1398057's user avatar
  • 2,405
37 votes
7 answers
17k views

Good sources for learning Markov chain Monte Carlo (MCMC)

Any suggestions for a good source to learn MCMC methods?
35 votes
3 answers
18k views

Why is it necessary to sample from the posterior distribution if we already KNOW the posterior distribution?

My understanding is that when using a Bayesian approach to estimate parameter values: The posterior distribution is the combination of the prior distribution and the likelihood distribution. We ...
Dave's user avatar
  • 2,641
32 votes
4 answers
25k views

What is the best method for checking convergence in MCMC?

What is your preferred method of checking for convergence when using Markov chain Monte Carlo for Bayesian inference, and why?
Graham Cookson's user avatar
31 votes
1 answer
7k views

Computation of the marginal likelihood from MCMC samples

This is a recurring question (see this post, this post and this post), but I have a different spin. Suppose I have a bunch of samples from a generic MCMC sampler. For each sample $\theta$, I know the ...
lacerbi's user avatar
  • 5,216
29 votes
1 answer
23k views

When would one use Gibbs sampling instead of Metropolis-Hastings?

There are different kinds of MCMC algorithms: Metropolis-Hastings Gibbs Importance/rejection sampling (related). Why would one use Gibbs sampling instead of Metropolis-Hastings? I suspect there ...
ShanZhengYang's user avatar
29 votes
3 answers
2k views

Examples of errors in MCMC algorithms

I'm investigating a method for automatic checking of Markov chain Monte Carlo methods, and I would like some examples of mistakes that can occur when constructing or implementing such algorithms. ...
Simon Byrne's user avatar
  • 3,506
28 votes
1 answer
7k views

Does the Gibbs Sampling algorithm guarantee detailed balance?

I have it on supreme authority1 that Gibbs Sampling is a special case of the Metropolis-Hastings algorithm for Markov Chain Monte Carlo sampling. The MH algorithm always gives a transition probability ...
Ian's user avatar
  • 483
27 votes
1 answer
5k views

Hamiltonian Monte Carlo vs. Sequential Monte Carlo

I am trying to get a feel for the relative merits and drawbacks, as well as different application domains of these two MCMC schemes. When would you use which and why? When might one fail but the ...
Astrid's user avatar
  • 989
25 votes
3 answers
11k views

Why should we care about rapid mixing in MCMC chains?

When working with Markov chain Monte Carlo to draw inference, we need a chain that mixes rapidly, i.e. moves throughly the support of the posterior distribution rapidly. But I don't understand why we ...
qkhhly's user avatar
  • 507
25 votes
2 answers
4k views

How do ABC and MCMC differ in their applications?

To my understanding Approximate Bayesian Computation (ABC) and Markov Chain Monte Carlo (MCMC) have very similar aims. Below I describe my understanding of these methods and how I perceive the ...
Remi.b's user avatar
  • 5,152
24 votes
1 answer
8k views

What MCMC algorithms/techniques are used for discrete parameters?

I know a fair amount about fitting continuous parameters particularly gradient-based methods, but not much about fitting discrete parameters. What are commonly used MCMC algorithms/techniques for ...
John Salvatier's user avatar
24 votes
2 answers
12k views

Gibbs sampling versus general MH-MCMC

I have just been doing some reading on Gibbs sampling and Metropolis Hastings algorithm and have a couple of questions. As I understand it, in the case of Gibbs sampling, if we have a large ...
Luca's user avatar
  • 4,700
23 votes
4 answers
8k views

Can Machine Learning or Deep Learning algorithms be utilised to "improve" the sampling process of a MCMC technique?

Based on the little knowledge that I have on MCMC (Markov chain Monte Carlo) methods, I understand that sampling is a crucial part of the aforementioned technique. The most commonly used sampling ...
Jespar's user avatar
  • 574
23 votes
4 answers
13k views

C++ libraries for statistical computing

I've got a particular MCMC algorithm which I would like to port to C/C++. Much of the expensive computation is in C already via Cython, but I want to have the whole sampler written in a compiled ...
JMS's user avatar
  • 4,890
23 votes
1 answer
5k views

Residual diagnostics in MCMC -based regression models

I've recently embarked on fitting regression mixed models in the Bayesian framework, using a MCMC algorithm (function MCMCglmm in R actually). I believe I have understood how to diagnose convergence ...
Rossinante's user avatar
23 votes
1 answer
948 views

Can adaptive MCMC be trusted?

I am reading about adaptive MCMC (see e.g., Chapter 4 of the Handbook of Markov Chain Monte Carlo, ed. Brooks et al., 2011; and also Andrieu & Thoms, 2008). The main result of Roberts and ...
lacerbi's user avatar
  • 5,216
22 votes
2 answers
10k views

Parameters without defined priors in Stan

I've just started to learn to use Stan and rstan. Unless I've always been confused about how JAGS/BUGS worked, I thought you always had to define a prior ...
JoFrhwld's user avatar
  • 2,457
22 votes
1 answer
5k views

Stan $\hat{R}$ versus Gelman-Rubin $\hat{R}$ definition

I was going through the Stan documentation which can be downloaded from here. I was particularly interested in their implementation of the Gelman-Rubin diagnostic. The original paper Gelman & ...
Greenparker's user avatar
  • 15.7k
21 votes
2 answers
2k views

When did MCMC become commonplace?

Does anyone know around what year MCMC became commonplace (i.e., a popular method for Bayesian inference)? A link to the number of published MCMC (journal) articles over time would be especially ...
Ethan Arenson's user avatar
21 votes
1 answer
2k views

What are some well known improvements over textbook MCMC algorithms that people use for bayesian inference?

When I'm coding a Monte Carlo simulation for some problem, and the model is simple enough, I use a very basic textbook Gibbs sampling. When it's not possible to use Gibbs sampling, I code the textbook ...
Rafael S. Calsaverini's user avatar
20 votes
4 answers
8k views

Posterior distribution and MCMC [duplicate]

I have read something like 6 articles on Markov Chain Monte carlo methods, there are a couple of basic points I can't seem to wrap my head around. How can you "draw samples from the posterior ...
Magnus's user avatar
  • 671
20 votes
1 answer
12k views

MCMC on a bounded parameter space?

I am trying to apply MCMC on a problem, but my priors(in my case they are $\alpha\in[0,1],\beta\in[0,1]$)) are restricted to an area? Can I use normal MCMC and ignore the samples that fall outside of ...
Cupitor's user avatar
  • 1,615
20 votes
2 answers
11k views

Effective Sample Size for posterior inference from MCMC sampling

When obtaining MCMC samples to make inference on a particular parameter, what are good guides for the minimum number of effective samples that one should aim for? And, does this advice change as the ...
Matt Albrecht's user avatar
19 votes
1 answer
17k views

Understanding Metropolis-Hastings with asymmetric proposal distribution

I have been trying to understand the Metropolis-Hastings algorithm in order to write a code for estimating the parameters of a model (i.e. $f(x)=a*x$). According to bibliography the Metropolis-...
AstrOne's user avatar
  • 739
19 votes
4 answers
2k views

Metropolis-Hastings algorithms used in practice

I was reading Christian Robert's Blog today and quite liked the new Metropolis-Hastings algorithm he was discussing. It seemed simple and easy to implement. Whenever I code up MCMC, I tend to stick ...
csgillespie's user avatar
  • 13.1k
18 votes
3 answers
2k views

Are MCMC without memory?

I'm trying to understand what Markov chain Monte Carlo (MCMC) are from the French Wikipedia page. They say "that the Markov chain Monte Carlo methods consist of generating a vector $x_ {i}$ only from ...
Revolucion for Monica's user avatar
18 votes
3 answers
2k views

Why don't we see Copula Models as much as Regression Models?

Is there any reason that don't see Copula Models as much as we see Regression Models (e.g. https://en.wikipedia.org/wiki/Vine_copula, https://en.wikipedia.org/wiki/Copula_(probability_theory)) ? I ...
stats_noob's user avatar
18 votes
3 answers
7k views

Is there a standard method to deal with label switching problem in MCMC estimation of mixture models?

Label switching (i.e., the posterior distribution is invariant to switching component labels) is a problematic issue when using MCMC to estimate mixture models. Is there a standard (as in widely ...
user avatar
18 votes
1 answer
16k views

Gelman and Rubin convergence diagnostic, how to generalise to work with vectors?

The Gelman and Rubin diagnostic is used to check the convergence of multiple mcmc chains run in parallel. It compares the within-chain variance to the between-chain variance, the exposition is below: ...
Tim's user avatar
  • 285
18 votes
1 answer
10k views

Understanding MCMC and the Metropolis-Hastings algorithm

Over the past few days I have been trying to understand how Markov Chain Monte Carlo (MCMC) works. In particular I have been trying to understand and implement the Metropolis-Hastings algorithm. So ...
AstrOne's user avatar
  • 739
18 votes
2 answers
9k views

Confused with MCMC Metropolis-Hastings variations: Random-Walk, Non-Random-Walk, Independent, Metropolis

Over the past few weeks I have been trying to understand MCMC and the Metropolis-Hastings algorithm(s). Every time I think I understand it I realise that I am wrong. Most of the code examples I find ...
AstrOne's user avatar
  • 739
17 votes
6 answers
13k views

Does standardising independent variables reduce collinearity?

I've come across a very good text on Bayes/MCMC. IT suggests that a standardisation of your independent variables will make an MCMC (Metropolis) algorithm more efficient, but also that it may reduce (...
user avatar
17 votes
2 answers
15k views

Predictions from BSTS model (in R) are failing completely

After reading this blog post about Bayesian structural time series models, I wanted to look at implementing this in the context of a problem I'd previously used ARIMA for. I have some data with some ...
anthr's user avatar
  • 937
17 votes
3 answers
2k views

Good summaries (reviews, books) on various applications of Markov chain Monte Carlo (MCMC)?

Are there any good summaries (reviews, books) on various applications of Markov chain Monte Carlo (MCMC)? I've seen Markov Chain Monte Carlo in Practice, but this books seems a bit old. Are there ...
Tianyang Li's user avatar
17 votes
2 answers
3k views

Sampling from an Improper Distribution (using MCMC and otherwise)

My basic question is: how would you sample from an improper distribution? Does it even make sense to sample from an improper distribution? Xi'an's comment here kind of addresses the question, but I ...
Greenparker's user avatar
  • 15.7k
17 votes
1 answer
7k views

What is the correct effective sample size (ESS) calculation?

I wish to compute the effective sample size (ESS) for a posterior sample of size $M$. I have looked at several documentations (e.g. WinBUGS p11; Stan sec 15.4) and several other Stack Exchange ...
Earlien's user avatar
  • 758
17 votes
2 answers
1k views

Hamiltonian monte carlo

Can someone explain the main idea behind Hamiltonian Monte Carlo methods and in which cases they will yield better results than Markov Chain Monte Carlo methods ?
user avatar
17 votes
2 answers
9k views

Where do the full conditionals come from in Gibbs sampling?

MCMC algorithms like Metropolis-Hastings and Gibbs sampling are ways of sampling from the joint posterior distributions. I think I understand and can implement metropolis-hasting pretty easily--you ...
cespinoza's user avatar
  • 812
17 votes
2 answers
3k views

Hit and run MCMC

I'm trying to implement the hit and run MCMC algorithm, but I'm having a bit of trouble understanding how to go about it. The general idea, is as follows: To generate a proposal jump in MH, we: ...
user avatar
17 votes
1 answer
2k views

Hamiltonian Monte Carlo: how to make sense of the Metropolis-Hasting proposal?

I am trying to understand the inner working of Hamiltonian Monte Carlo (HMC), but can't fully understand the part when we replace the deterministic time-integration with a Metropolis-Hasting proposal. ...
cwl's user avatar
  • 799
16 votes
3 answers
4k views

Doing MCMC: use jags/stan or implement it myself

I am new to Bayesian Statistics research. I heard from researchers that Bayesian researchers better implement MCMC by themselves rather than using tools like JAGS/Stan. May I ask what is the benefit ...
user112758's user avatar
16 votes
2 answers
2k views

What is the connection between Markov chain and Markov chain monte carlo

I am trying to understand Markov chains using SAS. I understand that a Markov process is one where the future state depends only on the current state and not on the past state and there is a ...
Victor's user avatar
  • 6,605
16 votes
2 answers
20k views

MCMC methods - burning samples?

In MCMC methods, I keep reading about 'burn-in' time or the number of samples to 'burn'. What is this exactly, and why is it needed? Once MCMC stabilizes, does it remain stable? How is the notion of ...
Amelio Vazquez-Reina's user avatar
16 votes
2 answers
3k views

When is MCMC useful?

I am having trouble in understanding in which situation the MCMC approach is actually useful. I am going through a toy example from the Kruschke book "Doing Bayesian Data Analysis: A Tutorial with R ...
Vaaal's user avatar
  • 587
16 votes
2 answers
11k views

Does a MCMC fulfilling detailed balance yields a stationary distribution?

I guess I understand the equation of the detailed balance condition, which states that for transition probability $q$ and stationary distribution $\pi$, a Markov Chain satisfies detailed balance if $$...
Mike Flynn's user avatar
  • 1,247
15 votes
3 answers
6k views

Is the MCMC simply a probabilistic gradient descent?

I'm learning about Markov Chain Monte Carlo methods, and to my undifferentiated mind, they basically resemble gradient descent with a stochastic component replacing the gradient computation. Is this a ...
Kaushik Ghose's user avatar
15 votes
3 answers
4k views

Why is MCMC needed when estimating a parameter using MAP

Given the formula for MAP estimation of a parameter Why is a MCMC (or similar) approach needed, couldn't I just take the derivative, set it to zero and then solve for the parameter?
Dänu's user avatar
  • 355

1
2 3 4 5
33