Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

A special type of Markov Chain Monte Carlo (MCMC) algorithm used to simulate from complex probability distributions. It is validated by Markov chain theory and offers a wide range of possible implementations.

0
votes
0answers
7 views

Autocorrelation, Autocovariance and Large lag Standard Error

I have time series generated data from Monte Carl-Metropolis Simulation. I have estimated correlation coefficients using: $r_k = \frac{c_k}{c_0}$ where $c_0$ is the varaiance and $c_k = \frac{1}{N}\...
0
votes
0answers
14 views

Standard Error in Auto correlated Data

I have time-series data generated via Metropolis algorithm - Monte Carlo simulations. Since these data must have some correlation between them, the formula of the standard error for IIDs variable must ...
0
votes
0answers
19 views

Adaptive Metropolis within Gibbs

I am trying to build a code to simulate from the target distribution $\mathcal{N}(0,1)$ with proposal $\mathcal{N}(\theta_{t-1}, \sigma_q^2)$. I would like to use adaptive metropolis within gibbs, to ...
0
votes
1answer
39 views

Metropolis-Hastings in a Bayesian Hierarchical model

I am trying to estimate a Bayesian Hierarchical model using the random-walk Metropolis-Hastings algorithm. While in a non-Hierarchical model, the algorithm is staight-forward, I am not sure I am ...
1
vote
1answer
30 views

MCMC samples for constructing a histogram

I am interested in generating samples from a density $\pi(\theta)$ to construct a histogram for $\pi(\theta)$ and to use these samples to generate samples of $f(\theta)$ for some function $f$. I may ...
1
vote
2answers
51 views

What to do once states are rejected in MCMC?

I need to generate samples from a pdf given by $\frac{f_Z(z)\cdot 1_{Z \in B}}{P(Z \in B)}$ where $Z \in \mathbb{R}^d$ is a normal random vector with independent components. $Z \in B$ is a set that is ...
1
vote
0answers
12 views

Choosing a custom proposal distribution in Metropolis-Hastings Monte Carlo

I have many states and have calculated a good custom proposal distribution for my Monte Carlo simulation. The system reaches a good solution faster than if it were to just use a randomly selected ...
1
vote
1answer
24 views

How can the support of proposal distribution impact convergence of RH-MH algorithm?

In the book Introducing Monte Carlo Methods by Casella and Robert, there's a sentence with which I'm having some trouble to understand. «If the domain explored in $q$ [proposal] is too small, ...
1
vote
1answer
45 views

Understanding the Delayed Rejection Metropolis algorithm (Mira, 2001a)

I'm having trouble understanding the algorithm as briefly described here, and I can't find the original paper by Mira since it seems to be from some obscure print journal (Metron Volume 59). The ...
1
vote
0answers
23 views

Understanding Adaptive Metropolis MCMC by Haario et al. 2001 [closed]

I'm using the Delayed Rejection Adaptive Metropolis (DRAM) algorithm (Haario et al., 2006) for some Bayesian inference and trying to get an intuition for it so I can be sure to use it properly. So far ...
2
votes
1answer
29 views

Metropolis Hastings algorithm without enough data [closed]

In a metropolis hastings algorithm if i have not data or enough data, this will give me the prior means? I am asking this because I have made an algorithm and when i use just a few data this is not ...
1
vote
1answer
41 views

Implementation of Metropolis-Hastings with conditional posterior

I'm trying to understand how to estimate the parameter vector $\mathbf{\theta} = (\theta_1,\theta_2, \theta_3)$ of a model using the MH algorithm. I am given a joint posterior density: $p(\mathbf{\...
2
votes
0answers
20 views

GARCH(2, 3) model with Metropolis-Hastings algorithm

Let's say I have a $GARCH(2, 3)$ model with $$\nu_i = \sigma_i\epsilon_i$$ where $\epsilon_i \sim N(0, 1)$ and $$\sigma_i^2 = a_0 + \sum\limits_{k = 1}^{2} a_k\sigma_{i - k}^2 + \sum\limits_{l = 1}^{3}...
1
vote
1answer
28 views

Formula for Autocorrelation

I have time-series data generated via Metropolis algorithm - Monte Carlo simulations. I need to know correlation between data points generated given by $r_k = c_k/c_0$ where $c_0$ is the variance of ...
3
votes
2answers
249 views

Why take the minimum in the acceptance ratio in the Metropolis-Hastings algorithm?

The Metropolis-Hastings ratio is defined as $$ \alpha(x'|x) = \min\left(1, \frac{P(x')g(x|x')}{P(x)g(x'|x)}\right) $$ and the state $x'$ is accepted if $u \leq \alpha(x'|x)$, where $u$ is ...
0
votes
0answers
19 views

The Hessian of multinomial Probit model

I wanted to implement multinomial probit in Bayesian with random-walk Metropolis Hasting. To achieve the best numerical efficiency when drawing $\beta$, I need to use the hessian matrix of $\beta$. ...
0
votes
0answers
19 views

Markov Chain Monte Carlo [duplicate]

what are the differences between M-H algorithm and M-H-within-Gibbs algorithm. If possible, upload for me the two algorithms please.
13
votes
1answer
523 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 & ...
2
votes
1answer
44 views

Can the Acceptance rate for Metropolis-Hastings be greater than 1?

Can the acceptance rate in MH algo be greater than 1? When that case occurs the proposal will off coruse be accepted with probability 1. But is it "ok" to allow a acceptance rate greater than 1?
1
vote
1answer
58 views

Metropolis-Hastings acceptance ratio for truncated proposal

I have a proposal distribution for one parameter theta_guess theta_guess = guessleft(theta_accept(1,r-1), 0.01,0) which is a ...
3
votes
2answers
184 views

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

Basic question about MCMC Metropolis–Hastings algorithm. I am trying to understand the Metropolis–Hastings algorithm and it's connection to Bayesian Analysis. Suppose I want to construct an MCMC MH ...
1
vote
0answers
23 views

Metropolis Hastings Kernel - Relation Indicator function and Dirac Mass

Why does the indicator function is equivalent to the integral over the Dirac mass? In my lecture notes the proof for the Kernel of the Metropolis Hastings is given as follows: $$P(X^t \in \mathcal{X}...
1
vote
1answer
50 views

Convergence issue in simple 1D Metropolis algorithm

I want to write a Metropolis sampler to sample independent rvs $x$ from the mixture model $X \sim \frac{1}{2}\big[\mathscr{N}(\mu_1, \sigma_1) + \mathscr{N}(\mu_2, \sigma_2)\big]$. My algorithm is ...
6
votes
1answer
60 views

sampling cost of $O(d)$ versus $O(2^d)$

I came across the following simulation problem: given a set $\{\omega_1,\ldots,\omega_d\}$ of known real numbers, a distribution on $\{-1,1\}^d$ is defined by $$\mathbb{P}(X=(x_1,\ldots,x_d))\propto (...
0
votes
0answers
36 views

How does Metropolis acceptance rate vary with the number of dimensions?

Intuitively, if I want to update two parameters in one step, I have to come up with a proposal that are good for both parameters. Assuming that the parameters are independent, is it correct to ...
0
votes
1answer
93 views

Show How to Generate a Poisson Random Variable with Parameter $\lambda$ using Metropolis-Hastings

Additionally: Use a simple symmetric random walk as the proposal distribution. Source: "Introduction to Stochastic Processes with R" - Robert P. Dobrow, Chapter 5 Exercises: Question 5.6 I know this ...
3
votes
2answers
72 views

Is it possible to merge acceptance probability with proposal distribution in Metropolis Hastings algorithm?

For an ergodic Markov chain, it doesn't necessarily have to be $Detailed\ Balanced $ when it converges to stationary distribution, which means that: $\pi(\theta)\ P(\theta^{\prime}|\theta) \neq \pi(\...
1
vote
1answer
120 views

MCMC: How to choose an efficient proposal distribution with continuous and discrete variables

I am using MCMC with the Metropolos-Hasting algorithm to generate solutions of a non linear regression problem. Likelihood My likelihood is a gaussian distribution centered in 0 of the residuals ...
4
votes
1answer
114 views

sampling from an unnormalised distribution

If one has to sample (with replacement) from a population $(x_1,x_2,\ldots)$ with weights $(\omega_1,\omega_2,\ldots)$, possibly infinite (although this is asking too much without further details), a ...
2
votes
1answer
128 views

Strategies to re-write the slow part of Metropolis Hastings in Rcpp [closed]

I want to speed up my R implementation of a Metropolis Hasting procedure by replacing the slow parts with functions written in Rcpp. There are already some examples online using Rcpp to speed up ...
3
votes
1answer
348 views

Metropolis-Within-Gibbs sampling with only marginal distribution known for a subset of variables

Typically in Gibbs sampling we want to sample from a joint distribution $p(X_1, X_2, ..., X_N)$, but because the joint is hard to sample from directly, we instead achieve this by iteratively sampling ...
1
vote
1answer
62 views

Question on Detailed Balance and Bayes' Rule

I think I am confused due to the lax notation typically used when dealing with probabilities and not having a formal probability background. Bayes' Rule tells me that $$Pr(X_t=a|X_{t+1}=b)Pr(X_{t+1}=...
2
votes
1answer
221 views

Why does detailed balance not provide a stopping criterion in MCMC?

Like I undestand MCMC sampling, the fulfillment of the detailed balance equation guarantees that our MC has reached its stationary distribution (given we ensure ergodicity). Detailed Balance is: $\...
3
votes
1answer
72 views

Metropolis-Hastings for heteroskedastic regression

Consider a heteroskedastic model of the form, $y_i|x_i \sim \mathcal{N}\left(x_i, \text{exp}\{\boldsymbol\beta^\top\boldsymbol{x}\}\right)$ where $\boldsymbol{\beta}=\left[\beta_0,\beta_1\right]$ and $...
4
votes
1answer
94 views

What is the name of this random variable?

Let $X \sim \text{Normal}(\mu, \sigma^2)$. Define $Y = \frac{e^X -1}{e^X+1}$. The inverse transformation is $X = \text{logit}\left(\frac{1+Y}{2}\right) = \log\left(\frac{1+Y}{1-Y} \right)$. By the ...
0
votes
1answer
55 views

Bayesian Modeling Understanding Metropolis Sampling

I'm working through a book called Bayesian Analysis in Python. The book focuses heavily on the package PyMC3 but is a little vague on the theory behind it. Say I'm looking at a model like this My ...
5
votes
1answer
163 views

Understanding the Typical Set for Markov chain Monte Carlo sampling

I started reading "A Conceptual Introduction to Hamiltonian Monte Carlo" today, and I've gotten stuck on understanding Betancourt's explanation of what a "typical set" is. If $q_1, q_2, \ldots, q_n$ ...
0
votes
1answer
106 views

Metropolis-Hastings Algorithm for Numerical Integration [duplicate]

I'm attempting to implement a Metropolis-Hastings Algorithm to evaluate integrals of the following form: $$I =\frac{1}{\sqrt\pi}\int_{-\infty}^{\infty} {f(x)\exp(-x^2)} \text{d}x$$ Now we can ...
1
vote
1answer
46 views

How would the size of my dataset influence MCMC output?

I'm runing MCMC using Metropolis-Hasting algorithm to fit an equation with 6 parameters on a dataset composed of 30 instances. How will the fact that my dataset is so small impact the posterio ...
0
votes
0answers
51 views

how to define the covariance matrix for a multidimensional gaussian distribution + updating in blocks MH

I want to sample from a multidimensional gaussian distribution to perform a metropolis hastings algorithm updating by blocks the $n$ parameters. In order to do this, I know that I require a vector $\...
3
votes
1answer
55 views

Apply change-of-variable technique to derive confidence region of twisted gaussian?

$X$ is a multivariate Gaussian, whose confidence region I can derive. $Y$ is a function of $X$, specifically $Y = (x_1, x_2 - b x_1^2 + 100b, x_3, \dots, x_n)$. I can use change-of-variable ...
0
votes
0answers
55 views

MCMC sampling from a convex set

Suppose that we are given the matrix, $$ A = \begin{pmatrix}6/5 & 3 & -3/10 & -4/10\\ 7/5 & -7/10 & 7/10 & 14/5\\ -6/10 & -7/10 &-1/2 & 3/10\\ 12/5 & 1 & ...
0
votes
0answers
17 views

Counting function evaluations in PyMC

I apparently do not understand correctly how nodes are updated in PyMC. I want to count the number of times that certain nodes are computed, in order to understand where CPU time will be spent when I ...
0
votes
0answers
98 views

Quantifying acceptance rate in Metropolis-Hastings MCMC with uniform priors

I am optimising a model with parameters with uniform bounded priors using Metropolis-Hastings sampling. When any of the parameters in the proposed parameter set is outside of these bounds I reject ...
2
votes
0answers
35 views

Marginal Likelihood of independent priors [closed]

Let $p(m,n|\pmb{X}) \propto f(m,n)$. Now using a metropolis Hasting's algorithm, I need to sample values for $(m,n)$. I plan on using a Bivariate normal distribution as the proposal function. I have ...
2
votes
1answer
61 views

Generating samples for $p(\theta_{i}|\pmb{x})$ if samples from $p(\phi|\pmb{x})$ are known

Suppose $X_{i}|\theta_{i} \sim D_{1}(\theta_{i})$ and $\theta_{i}|\phi \sim D_{2}(\phi)$. Moreover $\phi \sim D_{3}(c)$ where c is known. How would I generate samples for $p(\theta_{i}|\pmb{x})$ if I ...
0
votes
0answers
21 views

Computing likelihood for correlated time-series models

I'm trying to use MCMC to fit different models (e.g. auto-regressive, mean-reverting etc) to some time series data. In the MCMC examples that I can find, the observations at different time points are ...
4
votes
0answers
32 views

How to estimate the weight matrix in distribution $X = VWV^T$?

Suppose the 1 x N vector $V\in \{0,1\}^N$ comes from the pdf $f(V) = VWV^T$, where $W$ is a N x N positive definite matrix. If the weight matrix is given, I can use gibbs sampling to generate a ...
4
votes
2answers
166 views

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

I have been going through Radford Neal's excellent HMC book chapter in detail. However, there is one detail that I'm really obsessing with now, and I'm not sure if I'm thinking about it right. When ...
0
votes
0answers
32 views

Calculating conditional posterior of poisson linear model for football

I am trying to make a GIBBS/MH sampler for a bayesian model for football goal counts. (Without any specific packages(winbugs,jags etc)). Similar to this: I have the priors for the hyperparameters and ...