# How to do integration using MCMC?

I want to evaluate $I = \int_V f(\vec{x}) d\vec{x}$. The classical Monte Carlo method is to sample uniformly from within the integration volume $V$, and then compute $I \approx V \frac{1}{N} \sum_{i=1}^{N} f(\vec{x})$.

What if I sampled the $\vec{x}$'s using a MCMC approach (e.g. Metropolis-Hastings, slice sampling), how do I compute $I$? Specifically, if we use the above formular, what is $V$?

-
docs.google.com/… –  Steve Huntsman Oct 12 '10 at 5:23
More generally, a search on mcmc + integration yields plenty of PDFs. –  Steve Huntsman Oct 12 '10 at 5:23
I've searched it before asking and I found the document you sent. According to that doc, I have to factorize $f(x)$ into $h(X)$ and $p(x)$ where $p$ a proper pdf. Am I right? What if I cannot do this factorization? Is the regular Monte Carlo only choice? –  eakbas Oct 12 '10 at 17:04
I knew that sooner or later I'd see pdf used with two different meanings in close proximity. –  Gerry Myerson Oct 13 '10 at 5:16
Am I missing a trivial point here? I still do not know the answer to my question :) The documents I found on the web --as I understand them-- does not answer my question. –  eakbas Oct 27 '10 at 2:46

There are no significant changes when you switch from MC to MCMC. The major concept remains the same. You draw your samples according to some probability distribution (which ideally has a form of your integrand, or as close as possible to it). Then instead of drawing i.i.d. samples, you just put a Metropolis move on top of your existing MC integration routine.

The only conceptual difference is that you have a Markov chain. That means that you have the current sample (state) and each time you generate a new sample from the current one. You should compute the acceptance probability carefully though.

-