39 votes
Accepted

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

Firstly, let me note [somewhat pedantically] that There are several different kinds of MCMC algorithms: Metropolis-Hastings, Gibbs, importance/rejection sampling (related). importance and ...
Xi'an's user avatar
  • 106k
18 votes
Accepted

In Bayesian models, can you use Uniform(-inf, inf) as a prior?

On this forum, there are a lot of related questions and answers about flat priors, like the ones above. They are not uniform priors because they are not distributions but $\sigma$-finite measures (...
Xi'an's user avatar
  • 106k
16 votes
Accepted

Proposal distribution - Metropolis Hastings MCMC

A1: Indeed the Gaussian distribution is probably the most used proposal distribution primarily due to ease of use. However, one might want to use other proposal distributions for the following reason ...
Greenparker's user avatar
  • 15.6k
15 votes
Accepted

For Hamiltonian Monte Carlo, why does negating the momentum variables result in a symmetric proposal?

One of the reasons why the original construction of Hamiltonian Monte Carlo can be tricky to understand is that it is more restrictive than necessary, if only to simplify the theoretical proofs. In ...
Michael Betancourt's user avatar
14 votes
Accepted

Acceptance rate for Metropolis-Hastings > 0.5

The acceptance rate depends largely on the proposal distribution. If it has small variance, the ratio of the probabilities between the current point and the proposal will necessarily always be close ...
AaronDefazio's user avatar
  • 1,614
11 votes
Accepted

Understanding the Typical Set for Markov chain Monte Carlo sampling

$\mathrm{d}q$ is uniform across the entire space and that's the problem! Unfortunately as we consider higher-dimensional spaces out intuition of uniform starts failing us and we end up in conceptual ...
Michael Betancourt's user avatar
11 votes

Compute the likelihood in Metropolis–Hastings: How does it relate to a posterior in Bayesian Analysis?

There is a lot of confusion. You want to evaluate the posterior $$ f(\theta|\mathbf{y}) =\frac{f(\mathbf{y}|\theta)f(\theta)}{f(\mathbf{y})} $$ where I use $f()$ to indicate a density, to be as ...
niandra82's user avatar
  • 1,260
11 votes
Accepted

What is the relationship between Metropolis Hastings and Simulated Annealing?

Simulated annealing is a meta-heuristic algorithm used for optimization, that is finding the minimum/maximum of a function. Metropolis-Hastings is an algorithm used for exploring a function (finding ...
user2974951's user avatar
  • 7,813
10 votes
Accepted

MCMC in a frequentist setting

As indicated in the many comments, Markov Chain Monte Carlo is a special case of the Monte Carlo method, which is designed to approximate quantities related with a distribution via pseudo-random ...
Xi'an's user avatar
  • 106k
10 votes
Accepted

Why periodically skip updating a parameter in MCMC?

This type of fine-tuned (Gibbs) MCMC is appropriate for cases when one conditional distribution is most "sticky" than other conditional distributions in the problem. For instance, updating only one [...
Xi'an's user avatar
  • 106k
10 votes
Accepted

What is the deeper intuition behind the symmetric proposal distribution in the Metropolis-Hastings Algorithm?

1) the Normal and Uniform are symmetric probability density functions themselves, is this notion of "symmetry" the same as the "symmetry" above? Both distributions are symmetric around their mean....
Xi'an's user avatar
  • 106k
10 votes

Acceptance rate for Metropolis-Hastings > 0.5

An easy example of acceptance probability equal to one is when simulating from the exact target: in that case $$\dfrac{\pi(x')q(x',x)}{\pi(x)q(x,x')}=1\qquad\forall x,x'$$ While this sounds like an ...
Xi'an's user avatar
  • 106k
10 votes

Conditional distribution of $\exp(-|x|-|y|-a \cdot |x-y|)$

The conditional density kernels are: $$\begin{equation} \begin{aligned} f(x|y) &\propto \exp(-|x|-a \cdot |x-y|), \\[6pt] f(y|x) &\propto \exp(-|y|-a \cdot |x-y|). \\[6pt] \end{aligned} \end{...
Ben's user avatar
  • 125k
10 votes

How to draw from a uniform distribution over a large state space via MCMC

What you're looking for is almost exactly what "Metropolis-Hastings for Ratio-of-Uniforms" tries to do. There are unfortunately no known papers on this topic, but what is available are some ...
Greenparker's user avatar
  • 15.6k
9 votes

Implementing a Metropolis Hastings Algorithm in R

It is indeed a very poor idea to start learning a topic just from an on-line code with no explanation. Better read a book (like our Introduction to Monte Carlo methods with R!) or an introductory ...
Xi'an's user avatar
  • 106k
9 votes
Accepted

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

I followed the specific link given for Gelman & Rubin (1992) and it has $$ \hat{\sigma} = \frac{n-1}{n}W+ \frac{1}{n}B $$ as in the later versions, although $\hat{\sigma}$ replaced with $\hat{\...
Aki Vehtari's user avatar
8 votes
Accepted

What is a good proposal distribution for Metropolis-Hastings for strictly positive parameters?

The most natural [and generic] resolution [imo] is to turn $\theta$ into $\eta=\log\theta$ in the original problem so that $\eta$ is unconstrained. This allows for the use of random walk proposals ...
Xi'an's user avatar
  • 106k
8 votes

Gibbs sampling an Ising model with 0s and 1s

The Ising model is one of the simplest examples of distributions with intractable normalising constant: the exact definition of the pmf is $$\pi(x) \propto \exp\left\{-\beta \sum_{i=1}^{19} |x_{i+1}-...
Xi'an's user avatar
  • 106k
8 votes
Accepted

Conditional distribution of $\exp(-|x|-|y|-a \cdot |x-y|)$

Disclaimer: although there is nothing to complain about Ben's answer (!), except maybe that the normalising constant of the conditional is not of direct use, here is what I wrote while being off-...
Xi'an's user avatar
  • 106k
8 votes
Accepted

How does the Metropolis Algorithm "get off the ground"?

The confusion stems from a misunderstanding of the notation $$V \sim f_V$$ which means both (a) $V$ is a random variable with density $f_V$ and (b) $V$ is created by a PRNG algorithm that ...
Xi'an's user avatar
  • 106k
8 votes
Accepted

Using all Metropolis-Hastings proposals to estimate an integral

Recycling proposed values in a Metropolis-Hastings algorithm goes under the name of Rao-Blackwellisation. For instance, we made such a proposal in Casella and Robert (1996) Rao-Blackwellisation of ...
Xi'an's user avatar
  • 106k
8 votes

Monte Carlo Methods:

Preliminaries: The book Introducing Monte Carlo methods with R (no exclamation mark in the title, even though the Springer book series is called Use R!) was co-authored by my late friend George ...
Xi'an's user avatar
  • 106k
8 votes
Accepted

How to draw from a uniform distribution over a large state space via MCMC

Since you want to sample uniformly, $p(\xi) = c I(\xi \in S)$ so the ratio $\frac{p(\xi^*)}{p(\xi)} = I(\xi^* \in S)$ for all proposals $\xi^*$. In MH you accept with $\frac{p^*}{p}\frac{q}{q^*}$ but, ...
Hunaphu's user avatar
  • 2,211
7 votes

Multi parameter Metropolis-Hastings

You actually have a single joint prior, which is a function of the parameter vector $\theta = [a_1, ..., a_d]$. If the parameters are treated independently, the prior factorizes into a product of the '...
user20160's user avatar
  • 32.5k
7 votes

Use of Metropolis & Rejection & Inverse Transform sampling methods

It's not entirely correct to say that inverse methods are impossible to compute. There are perfectly good numerical approximations to the inverse Gaussian CDF. As far as I'm aware, plenty of methods ...
Alex R.'s user avatar
  • 13.9k
7 votes
Accepted

MCMC - Metropolis Hasting: formal derivation of detailed balance

That follows by an easy case distinction: If $P(x')g(x|x')>P(x)g(x'|x)$, then $A(x'|x)=1$ and, by symmetry, $A(x|x')=\frac{P(x)g(x'|x)}{P(x')g(x|x')}$ and the claim holds. The case $P(x')g(x|x')\le ...
Tobias Windisch's user avatar
7 votes
Accepted

Reconciling Langevin MC methods as one-step HMC versus as diffusion or brownian motion

The easiest way to understand why Langevin dynamics targets the "correct distribution" is to look at the corresponding Fokker-Planck equation. Let me be more precise. Let us assume that our target ...
thmusic's user avatar
  • 271
7 votes
Accepted

What is the intuition behind the Metropolis-Hastings Algorithm?

How is the $q$ distribution (the proposal) related to the intractable posterior? I don't see how $q$ popped out of nowhere. The posterior is not intractable: $f(x)$ must be available (in a ...
Xi'an's user avatar
  • 106k
7 votes
Accepted

MCMC acceptance formula clarification

Yes, indeed. See, e.g., Wikipedia article on Metropolis-Hastings algorithm: $$ A(x,x')=\min\left(1,\frac{P(x')}{P(x)}\frac{g(x|x')}{g(x'|x)}\right)$$ In practice one often simply generates a random ...
Roger V.'s user avatar
  • 3,973
6 votes

Is it OK to choose the MH proposal as the prior in a posterior simulation problem?

Besides the inefficiency of using the prior pointed out in other answers, there is one specific setting where one cannot use the prior distribution as proposal. This is when the prior distribution $\...
Xi'an's user avatar
  • 106k

Only top scored, non community-wiki answers of a minimum length are eligible